UNPKG

react-custom-gradient-button

Version:
28 lines (24 loc) 14.3 kB
(function(w,W){typeof exports=="object"&&typeof module<"u"?module.exports=W(require("react")):typeof define=="function"&&define.amd?define(["react"],W):(w=typeof globalThis<"u"?globalThis:w||self,w["react-custom-gradient-button"]=W(w.React))})(this,function(w){"use strict";const Z=(p=>p&&typeof p=="object"&&"default"in p?p:{default:p})(w),cr="";var Q={exports:{}},D={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ee;function Pe(){if(ee)return D;ee=1;var p=Z.default,m=Symbol.for("react.element"),A=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,P=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,S={key:!0,ref:!0,__self:!0,__source:!0};function T(b,l,R){var c,h={},O=null,Y=null;R!==void 0&&(O=""+R),l.key!==void 0&&(O=""+l.key),l.ref!==void 0&&(Y=l.ref);for(c in l)E.call(l,c)&&!S.hasOwnProperty(c)&&(h[c]=l[c]);if(b&&b.defaultProps)for(c in l=b.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:m,type:b,key:O,ref:Y,props:h,_owner:P.current}}return D.Fragment=A,D.jsx=T,D.jsxs=T,D}var F={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var re;function Se(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){var p=Z.default,m=Symbol.for("react.element"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),b=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),te=Symbol.iterator,je="@@iterator";function ke(e){if(e===null||typeof e!="object")return null;var r=te&&e[te]||e[je];return typeof r=="function"?r:null}var x=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function d(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];De("error",e,t)}}function De(e,r,t){{var n=x.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var u=t.map(function(o){return String(o)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var Fe=!1,Ae=!1,Ie=!1,$e=!1,We=!1,ne;ne=Symbol.for("react.module.reference");function Ye(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===S||We||e===P||e===R||e===c||$e||e===Y||Fe||Ae||Ie||typeof e=="object"&&e!==null&&(e.$$typeof===O||e.$$typeof===h||e.$$typeof===T||e.$$typeof===b||e.$$typeof===l||e.$$typeof===ne||e.getModuleId!==void 0))}function Le(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ae(e){return e.displayName||"Context"}function y(e){if(e==null)return null;if(typeof e.tag=="number"&&d("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case A:return"Portal";case S:return"Profiler";case P:return"StrictMode";case R:return"Suspense";case c:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case b:var r=e;return ae(r)+".Consumer";case T:var t=e;return ae(t._context)+".Provider";case l:return Le(e,e.render,"ForwardRef");case h:var n=e.displayName||null;return n!==null?n:y(e.type)||"Memo";case O:{var i=e,u=i._payload,o=i._init;try{return y(o(u))}catch{return null}}}return null}var C=Object.assign,I=0,oe,ie,ue,se,fe,le,ce;function de(){}de.__reactDisabledLog=!0;function Ne(){{if(I===0){oe=console.log,ie=console.info,ue=console.warn,se=console.error,fe=console.group,le=console.groupCollapsed,ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:de,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}I++}}function Ve(){{if(I--,I===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:C({},e,{value:oe}),info:C({},e,{value:ie}),warn:C({},e,{value:ue}),error:C({},e,{value:se}),group:C({},e,{value:fe}),groupCollapsed:C({},e,{value:le}),groupEnd:C({},e,{value:ce})})}I<0&&d("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var B=x.ReactCurrentDispatcher,q;function L(e,r,t){{if(q===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);q=n&&n[1]||""}return` `+q+e}}var G=!1,N;{var Me=typeof WeakMap=="function"?WeakMap:Map;N=new Me}function ve(e,r){if(!e||G)return"";{var t=N.get(e);if(t!==void 0)return t}var n;G=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=B.current,B.current=null,Ne();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(_){n=_}Reflect.construct(e,[],o)}else{try{o.call()}catch(_){n=_}e.call(o.prototype)}}else{try{throw Error()}catch(_){n=_}e()}}catch(_){if(_&&n&&typeof _.stack=="string"){for(var a=_.stack.split(` `),v=n.stack.split(` `),s=a.length-1,f=v.length-1;s>=1&&f>=0&&a[s]!==v[f];)f--;for(;s>=1&&f>=0;s--,f--)if(a[s]!==v[f]){if(s!==1||f!==1)do if(s--,f--,f<0||a[s]!==v[f]){var g=` `+a[s].replace(" at new "," at ");return e.displayName&&g.includes("<anonymous>")&&(g=g.replace("<anonymous>",e.displayName)),typeof e=="function"&&N.set(e,g),g}while(s>=1&&f>=0);break}}}finally{G=!1,B.current=u,Ve(),Error.prepareStackTrace=i}var k=e?e.displayName||e.name:"",we=k?L(k):"";return typeof e=="function"&&N.set(e,we),we}function Ue(e,r,t){return ve(e,!1)}function Be(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function V(e,r,t){if(e==null)return"";if(typeof e=="function")return ve(e,Be(e));if(typeof e=="string")return L(e);switch(e){case R:return L("Suspense");case c:return L("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return Ue(e.render);case h:return V(e.type,r,t);case O:{var n=e,i=n._payload,u=n._init;try{return V(u(i),r,t)}catch{}}}return""}var M=Object.prototype.hasOwnProperty,pe={},ge=x.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,t=V(e.type,e._source,r?r.type:null);ge.setExtraStackFrame(t)}else ge.setExtraStackFrame(null)}function qe(e,r,t,n,i){{var u=Function.call.bind(M);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var v=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&(U(i),d("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),U(null)),a instanceof Error&&!(a.message in pe)&&(pe[a.message]=!0,U(i),d("Failed %s type: %s",t,a.message),U(null))}}}var Ge=Array.isArray;function J(e){return Ge(e)}function Je(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ze(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function he(e){if(ze(e))return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Je(e)),be(e)}var $=x.ReactCurrentOwner,Ke={key:!0,ref:!0,__self:!0,__source:!0},ye,_e,z;z={};function He(e){if(M.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Xe(e){if(M.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ze(e,r){if(typeof e.ref=="string"&&$.current&&r&&$.current.stateNode!==r){var t=y($.current.type);z[t]||(d('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y($.current.type),e.ref),z[t]=!0)}}function Qe(e,r){{var t=function(){ye||(ye=!0,d("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function er(e,r){{var t=function(){_e||(_e=!0,d("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var rr=function(e,r,t,n,i,u,o){var a={$$typeof:m,type:e,key:r,ref:t,props:o,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function tr(e,r,t,n,i){{var u,o={},a=null,v=null;t!==void 0&&(he(t),a=""+t),Xe(r)&&(he(r.key),a=""+r.key),He(r)&&(v=r.ref,Ze(r,i));for(u in r)M.call(r,u)&&!Ke.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)o[u]===void 0&&(o[u]=s[u])}if(a||v){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&Qe(o,f),v&&er(o,f)}return rr(e,a,v,i,n,$.current,o)}}var K=x.ReactCurrentOwner,me=x.ReactDebugCurrentFrame;function j(e){if(e){var r=e._owner,t=V(e.type,e._source,r?r.type:null);me.setExtraStackFrame(t)}else me.setExtraStackFrame(null)}var H;H=!1;function X(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function Ee(){{if(K.current){var e=y(K.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function nr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` Check your code at `+r+":"+t+"."}return""}}var Re={};function ar(e){{var r=Ee();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` Check the top-level render call using <`+t+">.")}return r}}function Te(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ar(r);if(Re[t])return;Re[t]=!0;var n="";e&&e._owner&&e._owner!==K.current&&(n=" It was passed a child from "+y(e._owner.type)+"."),j(e),d('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),j(null)}}function Oe(e,r){{if(typeof e!="object")return;if(J(e))for(var t=0;t<e.length;t++){var n=e[t];X(n)&&Te(n,r)}else if(X(e))e._store&&(e._store.validated=!0);else if(e){var i=ke(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)X(o.value)&&Te(o.value,r)}}}function or(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===h))t=r.propTypes;else return;if(t){var n=y(r);qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!H){H=!0;var i=y(r);d("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&d("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ir(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){j(e),d("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),j(null);break}}e.ref!==null&&(j(e),d("Invalid attribute `ref` supplied to `React.Fragment`."),j(null))}}function Ce(e,r,t,n,i,u){{var o=Ye(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var v=nr(i);v?a+=v:a+=Ee();var s;e===null?s="null":J(e)?s="array":e!==void 0&&e.$$typeof===m?(s="<"+(y(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var f=tr(e,r,t,i,u);if(f==null)return f;if(o){var g=r.children;if(g!==void 0)if(n)if(J(g)){for(var k=0;k<g.length;k++)Oe(g[k],e);Object.freeze&&Object.freeze(g)}else d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Oe(g,e)}return e===E?ir(f):or(f),f}}function ur(e,r,t){return Ce(e,r,t,!0)}function sr(e,r,t){return Ce(e,r,t,!1)}var fr=sr,lr=ur;F.Fragment=E,F.jsx=fr,F.jsxs=lr}()),F}(function(p){process.env.NODE_ENV==="production"?p.exports=Pe():p.exports=Se()})(Q);const xe=Q.exports.jsx;return({children:p,className:m,color:A="white",start:E="#aa076b",middle:P="#61045f",end:S="#aa076b",borderRadius:T="0.5rem",width:b="",height:l="",style:R={},...c})=>xe("button",{style:{color:A,backgroundImage:`linear-gradient(to right, ${E} 0%, ${P} 51%, ${S} 100%)`,borderRadius:T,width:b,height:l,...R},tabIndex:0,className:`cstm-button-grd ${m||""}`,...c,children:p})});