react-clipboard-button
Advanced tools
Comparing version 1.0.0 to 2.0.0-rc1
@@ -787,3 +787,3 @@ var __defProp = Object.defineProperty; | ||
} | ||
}, [ref.current]); | ||
}); | ||
return /* @__PURE__ */ jsx("span", { | ||
@@ -790,0 +790,0 @@ ref, |
@@ -1,2 +0,2 @@ | ||
var bt=Object.defineProperty,mt=Object.defineProperties;var _t=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable;var B=(E,b,T)=>b in E?bt(E,b,{enumerable:!0,configurable:!0,writable:!0,value:T}):E[b]=T,N=(E,b)=>{for(var T in b||(b={}))Et.call(b,T)&&B(E,T,b[T]);if(z)for(var T of z(b))kt.call(b,T)&&B(E,T,b[T]);return E},W=(E,b)=>mt(E,_t(b));(function(E,b){typeof exports=="object"&&typeof module!="undefined"?b(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],b):(E=typeof globalThis!="undefined"?globalThis:E||self,b(E.CopyToClipboard={},E.require$$0))})(this,function(E,b){"use strict";function T(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var J=T(b),$=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function G(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var F={exports:{}};/*! | ||
var bt=Object.defineProperty,mt=Object.defineProperties;var _t=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable;var B=(E,g,T)=>g in E?bt(E,g,{enumerable:!0,configurable:!0,writable:!0,value:T}):E[g]=T,N=(E,g)=>{for(var T in g||(g={}))Et.call(g,T)&&B(E,T,g[T]);if(z)for(var T of z(g))kt.call(g,T)&&B(E,T,g[T]);return E},W=(E,g)=>mt(E,_t(g));(function(E,g){typeof exports=="object"&&typeof module!="undefined"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(E=typeof globalThis!="undefined"?globalThis:E||self,g(E.CopyToClipboard={},E.require$$0))})(this,function(E,g){"use strict";function T(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var J=T(g),$=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function G(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var F={exports:{}};/*! | ||
* clipboard.js v2.0.8 | ||
@@ -6,7 +6,7 @@ * https://clipboardjs.com/ | ||
* Licensed MIT © Zeno Rocha | ||
*/(function(r,g){(function(p,l){r.exports=l()})($,function(){return function(){var v={134:function(i,a,t){t.d(a,{default:function(){return vt}});var c=t(279),s=t.n(c),d=t(370),k=t.n(d),m=t(817),w=t.n(m);function h(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?h=function(e){return typeof e}:h=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(o)}function _(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")}function y(o,n){for(var e=0;e<n.length;e++){var u=n[e];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(o,u.key,u)}}function O(o,n,e){return n&&y(o.prototype,n),e&&y(o,e),o}var at=function(){function o(n){_(this,o),this.resolveOptions(n),this.initSelection()}return O(o,[{key:"resolveOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"createFakeElement",value:function(){var e=document.documentElement.getAttribute("dir")==="rtl";this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var u=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(u,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var e=this,u=this.createFakeElement();this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(u),this.selectedText=w()(u),this.copyText(),this.removeFake()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=w()(this.target),this.copyText()}},{key:"copyText",value:function(){var e;try{e=document.execCommand(this.action)}catch{e=!1}this.handleResult(e)}},{key:"handleResult",value:function(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"copy";if(this._action=e,this._action!=="copy"&&this._action!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(e){if(e!==void 0)if(e&&h(e)==="object"&&e.nodeType===1){if(this.action==="copy"&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(this.action==="cut"&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`);this._target=e}else throw new Error('Invalid "target" value, use a valid Element')},get:function(){return this._target}}]),o}(),ut=at;function j(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(e){return typeof e}:j=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(o)}function ct(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")}function q(o,n){for(var e=0;e<n.length;e++){var u=n[e];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(o,u.key,u)}}function st(o,n,e){return n&&q(o.prototype,n),e&&q(o,e),o}function ft(o,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),n&&R(o,n)}function R(o,n){return R=Object.setPrototypeOf||function(u,f){return u.__proto__=f,u},R(o,n)}function lt(o){var n=yt();return function(){var u=A(o),f;if(n){var S=A(this).constructor;f=Reflect.construct(u,arguments,S)}else f=u.apply(this,arguments);return dt(this,f)}}function dt(o,n){return n&&(j(n)==="object"||typeof n=="function")?n:ht(o)}function ht(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function yt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function A(o){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},A(o)}function L(o,n){var e="data-clipboard-".concat(o);if(!!n.hasAttribute(e))return n.getAttribute(e)}var pt=function(o){ft(e,o);var n=lt(e);function e(u,f){var S;return ct(this,e),S=n.call(this),S.resolveOptions(f),S.listenClick(u),S}return st(e,[{key:"resolveOptions",value:function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof f.action=="function"?f.action:this.defaultAction,this.target=typeof f.target=="function"?f.target:this.defaultTarget,this.text=typeof f.text=="function"?f.text:this.defaultText,this.container=j(f.container)==="object"?f.container:document.body}},{key:"listenClick",value:function(f){var S=this;this.listener=k()(f,"click",function(C){return S.onClick(C)})}},{key:"onClick",value:function(f){var S=f.delegateTarget||f.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new ut({action:this.action(S),target:this.target(S),text:this.text(S),container:this.container,trigger:S,emitter:this})}},{key:"defaultAction",value:function(f){return L("action",f)}},{key:"defaultTarget",value:function(f){var S=L("target",f);if(S)return document.querySelector(S)}},{key:"defaultText",value:function(f){return L("text",f)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],S=typeof f=="string"?[f]:f,C=!!document.queryCommandSupported;return S.forEach(function(gt){C=C&&!!document.queryCommandSupported(gt)}),C}}]),e}(s()),vt=pt},828:function(i){var a=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}function c(s,d){for(;s&&s.nodeType!==a;){if(typeof s.matches=="function"&&s.matches(d))return s;s=s.parentNode}}i.exports=c},438:function(i,a,t){var c=t(828);function s(m,w,h,_,y){var O=k.apply(this,arguments);return m.addEventListener(h,O,y),{destroy:function(){m.removeEventListener(h,O,y)}}}function d(m,w,h,_,y){return typeof m.addEventListener=="function"?s.apply(null,arguments):typeof h=="function"?s.bind(null,document).apply(null,arguments):(typeof m=="string"&&(m=document.querySelectorAll(m)),Array.prototype.map.call(m,function(O){return s(O,w,h,_,y)}))}function k(m,w,h,_){return function(y){y.delegateTarget=c(y.target,w),y.delegateTarget&&_.call(m,y)}}i.exports=d},879:function(i,a){a.node=function(t){return t!==void 0&&t instanceof HTMLElement&&t.nodeType===1},a.nodeList=function(t){var c=Object.prototype.toString.call(t);return t!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in t&&(t.length===0||a.node(t[0]))},a.string=function(t){return typeof t=="string"||t instanceof String},a.fn=function(t){var c=Object.prototype.toString.call(t);return c==="[object Function]"}},370:function(i,a,t){var c=t(879),s=t(438);function d(h,_,y){if(!h&&!_&&!y)throw new Error("Missing required arguments");if(!c.string(_))throw new TypeError("Second argument must be a String");if(!c.fn(y))throw new TypeError("Third argument must be a Function");if(c.node(h))return k(h,_,y);if(c.nodeList(h))return m(h,_,y);if(c.string(h))return w(h,_,y);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function k(h,_,y){return h.addEventListener(_,y),{destroy:function(){h.removeEventListener(_,y)}}}function m(h,_,y){return Array.prototype.forEach.call(h,function(O){O.addEventListener(_,y)}),{destroy:function(){Array.prototype.forEach.call(h,function(O){O.removeEventListener(_,y)})}}}function w(h,_,y){return s(document.body,h,_,y)}i.exports=d},817:function(i){function a(t){var c;if(t.nodeName==="SELECT")t.focus(),c=t.value;else if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){var s=t.hasAttribute("readonly");s||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),s||t.removeAttribute("readonly"),c=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var d=window.getSelection(),k=document.createRange();k.selectNodeContents(t),d.removeAllRanges(),d.addRange(k),c=d.toString()}return c}i.exports=a},279:function(i){function a(){}a.prototype={on:function(t,c,s){var d=this.e||(this.e={});return(d[t]||(d[t]=[])).push({fn:c,ctx:s}),this},once:function(t,c,s){var d=this;function k(){d.off(t,k),c.apply(s,arguments)}return k._=c,this.on(t,k,s)},emit:function(t){var c=[].slice.call(arguments,1),s=((this.e||(this.e={}))[t]||[]).slice(),d=0,k=s.length;for(d;d<k;d++)s[d].fn.apply(s[d].ctx,c);return this},off:function(t,c){var s=this.e||(this.e={}),d=s[t],k=[];if(d&&c)for(var m=0,w=d.length;m<w;m++)d[m].fn!==c&&d[m].fn._!==c&&k.push(d[m]);return k.length?s[t]=k:delete s[t],this}},i.exports=a,i.exports.TinyEmitter=a}},p={};function l(i){if(p[i])return p[i].exports;var a=p[i]={exports:{}};return v[i](a,a.exports,l),a.exports}return function(){l.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return l.d(a,{a}),a}}(),function(){l.d=function(i,a){for(var t in a)l.o(a,t)&&!l.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:a[t]})}}(),function(){l.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)}}(),l(134)}().default})})(F);var V=G(F.exports),P={exports:{}},x={};/* | ||
*/(function(r,b){(function(p,l){r.exports=l()})($,function(){return function(){var v={134:function(i,a,t){t.d(a,{default:function(){return vt}});var c=t(279),s=t.n(c),d=t(370),k=t.n(d),m=t(817),w=t.n(m);function h(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?h=function(e){return typeof e}:h=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(o)}function _(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")}function y(o,n){for(var e=0;e<n.length;e++){var u=n[e];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(o,u.key,u)}}function O(o,n,e){return n&&y(o.prototype,n),e&&y(o,e),o}var at=function(){function o(n){_(this,o),this.resolveOptions(n),this.initSelection()}return O(o,[{key:"resolveOptions",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"createFakeElement",value:function(){var e=document.documentElement.getAttribute("dir")==="rtl";this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var u=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(u,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var e=this,u=this.createFakeElement();this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(u),this.selectedText=w()(u),this.copyText(),this.removeFake()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=w()(this.target),this.copyText()}},{key:"copyText",value:function(){var e;try{e=document.execCommand(this.action)}catch{e=!1}this.handleResult(e)}},{key:"handleResult",value:function(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"copy";if(this._action=e,this._action!=="copy"&&this._action!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(e){if(e!==void 0)if(e&&h(e)==="object"&&e.nodeType===1){if(this.action==="copy"&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(this.action==="cut"&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`);this._target=e}else throw new Error('Invalid "target" value, use a valid Element')},get:function(){return this._target}}]),o}(),ut=at;function j(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(e){return typeof e}:j=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(o)}function ct(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")}function q(o,n){for(var e=0;e<n.length;e++){var u=n[e];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(o,u.key,u)}}function st(o,n,e){return n&&q(o.prototype,n),e&&q(o,e),o}function ft(o,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),n&&R(o,n)}function R(o,n){return R=Object.setPrototypeOf||function(u,f){return u.__proto__=f,u},R(o,n)}function lt(o){var n=yt();return function(){var u=A(o),f;if(n){var S=A(this).constructor;f=Reflect.construct(u,arguments,S)}else f=u.apply(this,arguments);return dt(this,f)}}function dt(o,n){return n&&(j(n)==="object"||typeof n=="function")?n:ht(o)}function ht(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function yt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function A(o){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},A(o)}function L(o,n){var e="data-clipboard-".concat(o);if(!!n.hasAttribute(e))return n.getAttribute(e)}var pt=function(o){ft(e,o);var n=lt(e);function e(u,f){var S;return ct(this,e),S=n.call(this),S.resolveOptions(f),S.listenClick(u),S}return st(e,[{key:"resolveOptions",value:function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof f.action=="function"?f.action:this.defaultAction,this.target=typeof f.target=="function"?f.target:this.defaultTarget,this.text=typeof f.text=="function"?f.text:this.defaultText,this.container=j(f.container)==="object"?f.container:document.body}},{key:"listenClick",value:function(f){var S=this;this.listener=k()(f,"click",function(C){return S.onClick(C)})}},{key:"onClick",value:function(f){var S=f.delegateTarget||f.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new ut({action:this.action(S),target:this.target(S),text:this.text(S),container:this.container,trigger:S,emitter:this})}},{key:"defaultAction",value:function(f){return L("action",f)}},{key:"defaultTarget",value:function(f){var S=L("target",f);if(S)return document.querySelector(S)}},{key:"defaultText",value:function(f){return L("text",f)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],S=typeof f=="string"?[f]:f,C=!!document.queryCommandSupported;return S.forEach(function(gt){C=C&&!!document.queryCommandSupported(gt)}),C}}]),e}(s()),vt=pt},828:function(i){var a=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}function c(s,d){for(;s&&s.nodeType!==a;){if(typeof s.matches=="function"&&s.matches(d))return s;s=s.parentNode}}i.exports=c},438:function(i,a,t){var c=t(828);function s(m,w,h,_,y){var O=k.apply(this,arguments);return m.addEventListener(h,O,y),{destroy:function(){m.removeEventListener(h,O,y)}}}function d(m,w,h,_,y){return typeof m.addEventListener=="function"?s.apply(null,arguments):typeof h=="function"?s.bind(null,document).apply(null,arguments):(typeof m=="string"&&(m=document.querySelectorAll(m)),Array.prototype.map.call(m,function(O){return s(O,w,h,_,y)}))}function k(m,w,h,_){return function(y){y.delegateTarget=c(y.target,w),y.delegateTarget&&_.call(m,y)}}i.exports=d},879:function(i,a){a.node=function(t){return t!==void 0&&t instanceof HTMLElement&&t.nodeType===1},a.nodeList=function(t){var c=Object.prototype.toString.call(t);return t!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in t&&(t.length===0||a.node(t[0]))},a.string=function(t){return typeof t=="string"||t instanceof String},a.fn=function(t){var c=Object.prototype.toString.call(t);return c==="[object Function]"}},370:function(i,a,t){var c=t(879),s=t(438);function d(h,_,y){if(!h&&!_&&!y)throw new Error("Missing required arguments");if(!c.string(_))throw new TypeError("Second argument must be a String");if(!c.fn(y))throw new TypeError("Third argument must be a Function");if(c.node(h))return k(h,_,y);if(c.nodeList(h))return m(h,_,y);if(c.string(h))return w(h,_,y);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function k(h,_,y){return h.addEventListener(_,y),{destroy:function(){h.removeEventListener(_,y)}}}function m(h,_,y){return Array.prototype.forEach.call(h,function(O){O.addEventListener(_,y)}),{destroy:function(){Array.prototype.forEach.call(h,function(O){O.removeEventListener(_,y)})}}}function w(h,_,y){return s(document.body,h,_,y)}i.exports=d},817:function(i){function a(t){var c;if(t.nodeName==="SELECT")t.focus(),c=t.value;else if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){var s=t.hasAttribute("readonly");s||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),s||t.removeAttribute("readonly"),c=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var d=window.getSelection(),k=document.createRange();k.selectNodeContents(t),d.removeAllRanges(),d.addRange(k),c=d.toString()}return c}i.exports=a},279:function(i){function a(){}a.prototype={on:function(t,c,s){var d=this.e||(this.e={});return(d[t]||(d[t]=[])).push({fn:c,ctx:s}),this},once:function(t,c,s){var d=this;function k(){d.off(t,k),c.apply(s,arguments)}return k._=c,this.on(t,k,s)},emit:function(t){var c=[].slice.call(arguments,1),s=((this.e||(this.e={}))[t]||[]).slice(),d=0,k=s.length;for(d;d<k;d++)s[d].fn.apply(s[d].ctx,c);return this},off:function(t,c){var s=this.e||(this.e={}),d=s[t],k=[];if(d&&c)for(var m=0,w=d.length;m<w;m++)d[m].fn!==c&&d[m].fn._!==c&&k.push(d[m]);return k.length?s[t]=k:delete s[t],this}},i.exports=a,i.exports.TinyEmitter=a}},p={};function l(i){if(p[i])return p[i].exports;var a=p[i]={exports:{}};return v[i](a,a.exports,l),a.exports}return function(){l.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return l.d(a,{a}),a}}(),function(){l.d=function(i,a){for(var t in a)l.o(a,t)&&!l.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:a[t]})}}(),function(){l.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)}}(),l(134)}().default})})(F);var V=G(F.exports),P={exports:{}},x={};/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/var M=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;function Q(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Z(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var g={},v=0;v<10;v++)g["_"+String.fromCharCode(v)]=v;var p=Object.getOwnPropertyNames(g).map(function(i){return g[i]});if(p.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(i){l[i]=i}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Z();/** @license React v17.0.2 | ||
*/var M=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;function Q(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Z(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var b={},v=0;v<10;v++)b["_"+String.fromCharCode(v)]=v;var p=Object.getOwnPropertyNames(b).map(function(i){return b[i]});if(p.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(i){l[i]=i}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Z();/** @license React v17.0.2 | ||
* react-jsx-runtime.production.min.js | ||
@@ -18,2 +18,2 @@ * | ||
* LICENSE file in the root directory of this source tree. | ||
*/var tt=J.default,H=60103;if(x.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var D=Symbol.for;H=D("react.element"),x.Fragment=D("react.fragment")}var et=tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,nt=Object.prototype.hasOwnProperty,rt={key:!0,ref:!0,__self:!0,__source:!0};function I(r,g,v){var p,l={},i=null,a=null;v!==void 0&&(i=""+v),g.key!==void 0&&(i=""+g.key),g.ref!==void 0&&(a=g.ref);for(p in g)nt.call(g,p)&&!rt.hasOwnProperty(p)&&(l[p]=g[p]);if(r&&r.defaultProps)for(p in g=r.defaultProps,g)l[p]===void 0&&(l[p]=g[p]);return{$$typeof:H,type:r,key:i,ref:a,props:l,_owner:et.current}}x.jsx=I,x.jsxs=I,P.exports=x;const U=P.exports.jsx,ot=P.exports.jsxs,Y=r=>{const g=b.useRef();return b.useEffect(()=>{if(g){const v=new V(g.current,{text:()=>r.text});return v.on("success",p=>{var l;return(l=r.onSuccess)==null?void 0:l.call(r,p)}),v.on("error",p=>{var l;return(l=r.onError)==null?void 0:l.call(r,p)}),()=>{try{v.destroy()}catch{}}}},[g.current]),U("span",{ref:g,style:r.style,className:r.className,title:r.title,children:r.children})},it=r=>ot("div",{style:{position:"relative"},children:[U(Y,W(N({},r),{style:N({position:"absolute",top:"5px",right:"5px"},r.style),children:r.button})),r.children]});E.CopyToClipboardButton=Y,E.CopyToClipboardWrapper=it,Object.defineProperty(E,"__esModule",{value:!0}),E[Symbol.toStringTag]="Module"}); | ||
*/var tt=J.default,H=60103;if(x.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var D=Symbol.for;H=D("react.element"),x.Fragment=D("react.fragment")}var et=tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,nt=Object.prototype.hasOwnProperty,rt={key:!0,ref:!0,__self:!0,__source:!0};function I(r,b,v){var p,l={},i=null,a=null;v!==void 0&&(i=""+v),b.key!==void 0&&(i=""+b.key),b.ref!==void 0&&(a=b.ref);for(p in b)nt.call(b,p)&&!rt.hasOwnProperty(p)&&(l[p]=b[p]);if(r&&r.defaultProps)for(p in b=r.defaultProps,b)l[p]===void 0&&(l[p]=b[p]);return{$$typeof:H,type:r,key:i,ref:a,props:l,_owner:et.current}}x.jsx=I,x.jsxs=I,P.exports=x;const U=P.exports.jsx,ot=P.exports.jsxs,Y=r=>{const b=g.useRef();return g.useEffect(()=>{if(b){const v=new V(b.current,{text:()=>r.text});return v.on("success",p=>{var l;return(l=r.onSuccess)==null?void 0:l.call(r,p)}),v.on("error",p=>{var l;return(l=r.onError)==null?void 0:l.call(r,p)}),()=>{try{v.destroy()}catch{}}}}),U("span",{ref:b,style:r.style,className:r.className,title:r.title,children:r.children})},it=r=>ot("div",{style:{position:"relative"},children:[U(Y,W(N({},r),{style:N({position:"absolute",top:"5px",right:"5px"},r.style),children:r.button})),r.children]});E.CopyToClipboardButton=Y,E.CopyToClipboardWrapper=it,Object.defineProperty(E,"__esModule",{value:!0}),E[Symbol.toStringTag]="Module"}); |
{ | ||
"name": "react-clipboard-button", | ||
"version": "1.0.0", | ||
"version": "2.0.0-rc1", | ||
"files": [ | ||
@@ -13,4 +13,10 @@ "dist", | ||
".": { | ||
"import": "./dist/lib.es.js", | ||
"require": "./dist/lib.umd.js" | ||
"import": { | ||
"types": "./types/lib.d.ts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./types/lib.d.ts", | ||
"default": "./dist/lib.umd.js" | ||
} | ||
} | ||
@@ -20,13 +26,16 @@ }, | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"build": "tsc && vite build && attw --pack", | ||
"serve": "vite preview" | ||
}, | ||
"dependencies": { | ||
"clipboard": "^2.0.8", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0" | ||
"clipboard": "^2.0.8" | ||
}, | ||
"peerDependencies": { | ||
"react": "^17 || ^18", | ||
"react-dom": "^17 || ^18" | ||
}, | ||
"devDependencies": { | ||
"highlight.js": "^11.3.1", | ||
"react-hot-toast": "^2.1.1", | ||
"@arethetypeswrong/cli": "^0.9.0", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0", | ||
"@types/node": "^16.11.11", | ||
@@ -36,2 +45,4 @@ "@types/react": "^17.0.0", | ||
"@vitejs/plugin-react": "^1.0.0", | ||
"highlight.js": "^11.3.1", | ||
"react-hot-toast": "^2.1.1", | ||
"typescript": "^4.3.2", | ||
@@ -38,0 +49,0 @@ "vite": "^2.6.4" |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
48702
11
3
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
- Removedreact@^17.0.0
- Removedreact-dom@^17.0.0
- Removedobject-assign@4.1.1(transitive)
- Removedreact@17.0.2(transitive)
- Removedreact-dom@17.0.2(transitive)
- Removedscheduler@0.20.2(transitive)