aura-toast 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aura-toast.cjs.js +10 -10
- package/dist/aura-toast.es.js +170 -162
- package/dist/core/ToastStore.d.ts +1 -0
- package/package.json +1 -1
package/dist/aura-toast.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var pr=Object.defineProperty;var mr=(i,
|
|
1
|
+
"use strict";var pr=Object.defineProperty;var mr=(i,n,p)=>n in i?pr(i,n,{enumerable:!0,configurable:!0,writable:!0,value:p}):i[n]=p;var F=(i,n,p)=>(mr(i,typeof n!="symbol"?n+"":n,p),p);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./react");class yr{constructor(){F(this,"state",null);F(this,"listeners",new Set);F(this,"timeoutId",null);F(this,"startTime",null);F(this,"remainingDuration",null)}getState(){return this.state}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}notify(){this.listeners.forEach(n=>n(this.state))}isDuplicate(n){return this.state?this.state.message===n.message&&(this.state.type||"info")===(n.type||"info")&&this.state.description===n.description&&this.state.glassy===n.glassy:!1}show(n){if(this.isDuplicate(n)){const x=n.duration??4e3;x>0&&(this.startTime=Date.now(),this.remainingDuration=x,this.startTimer(x));return}this.dismiss();const p=n.id||Math.random().toString(36).substring(2,9),v=n.duration??4e3;this.state={...n,id:p,type:n.type||"info",duration:v},this.notify(),v>0&&(this.startTime=Date.now(),this.remainingDuration=v,this.startTimer(v))}startTimer(n){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.dismiss()},n)}pause(){if(!this.state||!this.timeoutId||!this.startTime)return;clearTimeout(this.timeoutId),this.timeoutId=null;const n=Date.now()-this.startTime;this.remainingDuration=Math.max(0,(this.remainingDuration||0)-n),this.startTime=null}resume(){!this.state||this.timeoutId||this.remainingDuration===null||this.remainingDuration<=0||(this.startTime=Date.now(),this.startTimer(this.remainingDuration))}dismiss(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.state=null,this.startTime=null,this.remainingDuration=null,this.notify()}}const T=new yr,te={success:(i,n)=>T.show({...n,message:i,type:"success"}),error:(i,n)=>T.show({...n,message:i,type:"error"}),info:(i,n)=>T.show({...n,message:i,type:"info"}),warning:(i,n)=>T.show({...n,message:i,type:"warning"}),dismiss:()=>T.dismiss(),pause:()=>T.pause(),resume:()=>T.resume()};var ne={exports:{}},N={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ce;function gr(){if(Ce)return N;Ce=1;var i=Y,
|
|
9
|
+
*/var Ce;function gr(){if(Ce)return N;Ce=1;var i=Y,n=Symbol.for("react.element"),p=Symbol.for("react.fragment"),v=Object.prototype.hasOwnProperty,x=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,S={key:!0,ref:!0,__self:!0,__source:!0};function w(R,m,P){var b,j={},k=null,V=null;P!==void 0&&(k=""+P),m.key!==void 0&&(k=""+m.key),m.ref!==void 0&&(V=m.ref);for(b in m)v.call(m,b)&&!S.hasOwnProperty(b)&&(j[b]=m[b]);if(R&&R.defaultProps)for(b in m=R.defaultProps,m)j[b]===void 0&&(j[b]=m[b]);return{$$typeof:n,type:R,key:k,ref:V,props:j,_owner:x.current}}return N.Fragment=p,N.jsx=w,N.jsxs=w,N}var M={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Oe;function br(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){var i=Y,
|
|
18
|
-
`+z+e}}var G=!1,B;{var Be=typeof WeakMap=="function"?WeakMap:Map;B=new Be}function pe(e,r){if(!e||G)return"";{var t=B.get(e);if(t!==void 0)return t}var
|
|
19
|
-
`),y=
|
|
20
|
-
`),f=
|
|
21
|
-
`+
|
|
17
|
+
*/var Oe;function br(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){var i=Y,n=Symbol.for("react.element"),p=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),R=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),ae=Symbol.iterator,De="@@iterator";function Ie(e){if(e===null||typeof e!="object")return null;var r=ae&&e[ae]||e[De];return typeof r=="function"?r:null}var D=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];Ae("error",e,t)}}function Ae(e,r,t){{var a=D.ReactDebugCurrentFrame,l=a.getStackAddendum();l!==""&&(r+="%s",t=t.concat([l]));var c=t.map(function(o){return String(o)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var Fe=!1,Le=!1,We=!1,$e=!1,Ne=!1,ie;ie=Symbol.for("react.module.reference");function Me(e){return!!(typeof e=="string"||typeof e=="function"||e===v||e===S||Ne||e===x||e===P||e===b||$e||e===V||Fe||Le||We||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===j||e.$$typeof===w||e.$$typeof===R||e.$$typeof===m||e.$$typeof===ie||e.getModuleId!==void 0))}function Ye(e,r,t){var a=e.displayName;if(a)return a;var l=r.displayName||r.name||"";return l!==""?t+"("+l+")":t}function se(e){return e.displayName||"Context"}function _(e){if(e==null)return null;if(typeof e.tag=="number"&&h("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 v:return"Fragment";case p:return"Portal";case S:return"Profiler";case x:return"StrictMode";case P:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var r=e;return se(r)+".Consumer";case w:var t=e;return se(t._context)+".Provider";case m:return Ye(e,e.render,"ForwardRef");case j:var a=e.displayName||null;return a!==null?a:_(e.type)||"Memo";case k:{var l=e,c=l._payload,o=l._init;try{return _(o(c))}catch{return null}}}return null}var C=Object.assign,L=0,oe,ue,le,ce,fe,de,ve;function he(){}he.__reactDisabledLog=!0;function Ve(){{if(L===0){oe=console.log,ue=console.info,le=console.warn,ce=console.error,fe=console.group,de=console.groupCollapsed,ve=console.groupEnd;var e={configurable:!0,enumerable:!0,value:he,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}L++}}function Ue(){{if(L--,L===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:C({},e,{value:oe}),info:C({},e,{value:ue}),warn:C({},e,{value:le}),error:C({},e,{value:ce}),group:C({},e,{value:fe}),groupCollapsed:C({},e,{value:de}),groupEnd:C({},e,{value:ve})})}L<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=D.ReactCurrentDispatcher,z;function U(e,r,t){{if(z===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);z=a&&a[1]||""}return`
|
|
18
|
+
`+z+e}}var G=!1,B;{var Be=typeof WeakMap=="function"?WeakMap:Map;B=new Be}function pe(e,r){if(!e||G)return"";{var t=B.get(e);if(t!==void 0)return t}var a;G=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=K.current,K.current=null,Ve();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(g){a=g}Reflect.construct(e,[],o)}else{try{o.call()}catch(g){a=g}e.call(o.prototype)}}else{try{throw Error()}catch(g){a=g}e()}}catch(g){if(g&&a&&typeof g.stack=="string"){for(var s=g.stack.split(`
|
|
19
|
+
`),y=a.stack.split(`
|
|
20
|
+
`),f=s.length-1,d=y.length-1;f>=1&&d>=0&&s[f]!==y[d];)d--;for(;f>=1&&d>=0;f--,d--)if(s[f]!==y[d]){if(f!==1||d!==1)do if(f--,d--,d<0||s[f]!==y[d]){var E=`
|
|
21
|
+
`+s[f].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),typeof e=="function"&&B.set(e,E),E}while(f>=1&&d>=0);break}}}finally{G=!1,K.current=c,Ue(),Error.prepareStackTrace=l}var A=e?e.displayName||e.name:"",O=A?U(A):"";return typeof e=="function"&&B.set(e,O),O}function qe(e,r,t){return pe(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function q(e,r,t){if(e==null)return"";if(typeof e=="function")return pe(e,Je(e));if(typeof e=="string")return U(e);switch(e){case P:return U("Suspense");case b:return U("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case m:return qe(e.render);case j:return q(e.type,r,t);case k:{var a=e,l=a._payload,c=a._init;try{return q(c(l),r,t)}catch{}}}return""}var W=Object.prototype.hasOwnProperty,me={},ye=D.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,t=q(e.type,e._source,r?r.type:null);ye.setExtraStackFrame(t)}else ye.setExtraStackFrame(null)}function Ke(e,r,t,a,l){{var c=Function.call.bind(W);for(var o in e)if(c(e,o)){var s=void 0;try{if(typeof e[o]!="function"){var y=Error((a||"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 y.name="Invariant Violation",y}s=e[o](r,o,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(f){s=f}s&&!(s instanceof Error)&&(J(l),h("%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).",a||"React class",t,o,typeof s),J(null)),s instanceof Error&&!(s.message in me)&&(me[s.message]=!0,J(l),h("Failed %s type: %s",t,s.message),J(null))}}}var ze=Array.isArray;function X(e){return ze(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Xe(e){try{return ge(e),!1}catch{return!0}}function ge(e){return""+e}function be(e){if(Xe(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),ge(e)}var $=D.ReactCurrentOwner,He={key:!0,ref:!0,__self:!0,__source:!0},Ee,xe,H;H={};function Ze(e){if(W.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Qe(e){if(W.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function er(e,r){if(typeof e.ref=="string"&&$.current&&r&&$.current.stateNode!==r){var t=_($.current.type);H[t]||(h('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',_($.current.type),e.ref),H[t]=!0)}}function rr(e,r){{var t=function(){Ee||(Ee=!0,h("%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 tr(e,r){{var t=function(){xe||(xe=!0,h("%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 nr=function(e,r,t,a,l,c,o){var s={$$typeof:n,type:e,key:r,ref:t,props:o,_owner:c};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function ar(e,r,t,a,l){{var c,o={},s=null,y=null;t!==void 0&&(be(t),s=""+t),Qe(r)&&(be(r.key),s=""+r.key),Ze(r)&&(y=r.ref,er(r,l));for(c in r)W.call(r,c)&&!He.hasOwnProperty(c)&&(o[c]=r[c]);if(e&&e.defaultProps){var f=e.defaultProps;for(c in f)o[c]===void 0&&(o[c]=f[c])}if(s||y){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&rr(o,d),y&&tr(o,d)}return nr(e,s,y,l,a,$.current,o)}}var Z=D.ReactCurrentOwner,Re=D.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,t=q(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(t)}else Re.setExtraStackFrame(null)}var Q;Q=!1;function ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function _e(){{if(Z.current){var e=_(Z.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function ir(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+r+":"+t+"."}return""}}var Te={};function
|
|
25
|
+
Check your code at `+r+":"+t+"."}return""}}var Te={};function sr(e){{var r=_e();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+t+">.")}return r}}function je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=
|
|
27
|
+
Check the top-level render call using <`+t+">.")}return r}}function je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=sr(r);if(Te[t])return;Te[t]=!0;var a="";e&&e._owner&&e._owner!==Z.current&&(a=" It was passed a child from "+_(e._owner.type)+"."),I(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),I(null)}}function we(e,r){{if(typeof e!="object")return;if(X(e))for(var t=0;t<e.length;t++){var a=e[t];ee(a)&&je(a,r)}else if(ee(e))e._store&&(e._store.validated=!0);else if(e){var l=Ie(e);if(typeof l=="function"&&l!==e.entries)for(var c=l.call(e),o;!(o=c.next()).done;)ee(o.value)&&je(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===m||r.$$typeof===j))t=r.propTypes;else return;if(t){var a=_(r);Ke(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!Q){Q=!0;var l=_(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){I(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),I(null);break}}e.ref!==null&&(I(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var Se={};function ke(e,r,t,a,l,c){{var o=Me(e);if(!o){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" 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 y=ir(l);y?s+=y:s+=_e();var f;e===null?f="null":X(e)?f="array":e!==void 0&&e.$$typeof===n?(f="<"+(_(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):f=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",f,s)}var d=ar(e,r,t,l,c);if(d==null)return d;if(o){var E=r.children;if(E!==void 0)if(a)if(X(E)){for(var A=0;A<E.length;A++)we(E[A],e);Object.freeze&&Object.freeze(E)}else h("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 we(E,e)}if(W.call(r,"key")){var O=_(e),g=Object.keys(r).filter(function(hr){return hr!=="key"}),re=g.length>0?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}";if(!Se[O+re]){var vr=g.length>0?"{"+g.join(": ..., ")+": ...}":"{}";h(`A props object containing a "key" prop is being spread into JSX:
|
|
28
28
|
let props = %s;
|
|
29
29
|
<%s {...props} />
|
|
30
30
|
React keys must be passed directly to JSX without using spread:
|
|
31
31
|
let props = %s;
|
|
32
|
-
<%s key={someKey} {...props} />`,re,
|
|
32
|
+
<%s key={someKey} {...props} />`,re,O,vr,O),Se[O+re]=!0}}return e===v?ur(d):or(d),d}}function lr(e,r,t){return ke(e,r,t,!0)}function cr(e,r,t){return ke(e,r,t,!1)}var fr=cr,dr=lr;M.Fragment=v,M.jsx=fr,M.jsxs=dr}()),M}process.env.NODE_ENV==="production"?ne.exports=gr():ne.exports=br();var u=ne.exports;const Er=()=>u.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),u.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),xr=()=>u.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),u.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),Rr=()=>u.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),u.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),_r=()=>u.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),u.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),u.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),Pe=({config:i})=>{var S,w;const[n,p]=Y.useState(!1),v=()=>{p(!0),setTimeout(()=>{T.dismiss()},300)},x={success:Er,error:xr,info:Rr,warning:_r}[i.type||"info"];return u.jsxs("div",{className:`aura-toast ${i.type||"info"} ${i.glassy!==!1?"aura-toast-glassy":""} ${n?"aura-toast-exit":"aura-toast-enter"} ${i.className||""}`,onMouseEnter:()=>te.pause(),onMouseLeave:()=>te.resume(),style:{...i.style,...(S=i.style)!=null&&S["--type-color"]?{"--type-color":i.style["--type-color"]}:{},...(w=i.style)!=null&&w["--type-glow"]?{"--type-glow":i.style["--type-glow"]}:{}},children:[u.jsx("div",{className:"aura-icon-container",children:u.jsx("div",{className:"aura-icon",children:u.jsx(x,{})})}),u.jsxs("div",{className:"aura-content",children:[u.jsx("p",{className:"aura-message",children:i.message}),i.description&&u.jsx("p",{className:"aura-description",children:i.description})]}),i.action&&u.jsx("div",{className:"aura-action-container",children:u.jsx("button",{className:"aura-action",onClick:()=>{var R;(R=i.action)==null||R.onClick(),v()},children:i.action.label})}),u.jsx("button",{className:"aura-close",onClick:v,"aria-label":"Close",children:u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})};const Tr=({children:i})=>{const[n,p]=Y.useState(null);return Y.useEffect(()=>T.subscribe(v=>{p(v)}),[]),u.jsxs(u.Fragment,{children:[i,u.jsx("div",{className:"aura-container",children:n&&u.jsx(Pe,{config:n},n.id)})]})};exports.AuraProvider=Tr;exports.AuraToast=Pe;exports.auraToast=te;exports.toastStore=T;
|
package/dist/aura-toast.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var pr = Object.defineProperty;
|
|
2
|
-
var mr = (i,
|
|
3
|
-
var F = (i,
|
|
2
|
+
var mr = (i, n, p) => n in i ? pr(i, n, { enumerable: !0, configurable: !0, writable: !0, value: p }) : i[n] = p;
|
|
3
|
+
var F = (i, n, p) => (mr(i, typeof n != "symbol" ? n + "" : n, p), p);
|
|
4
4
|
import Oe, { useState as Pe, useEffect as yr } from "./react";
|
|
5
5
|
class gr {
|
|
6
6
|
constructor() {
|
|
@@ -13,33 +13,41 @@ class gr {
|
|
|
13
13
|
getState() {
|
|
14
14
|
return this.state;
|
|
15
15
|
}
|
|
16
|
-
subscribe(
|
|
17
|
-
return this.listeners.add(
|
|
16
|
+
subscribe(n) {
|
|
17
|
+
return this.listeners.add(n), () => this.listeners.delete(n);
|
|
18
18
|
}
|
|
19
19
|
notify() {
|
|
20
|
-
this.listeners.forEach((
|
|
20
|
+
this.listeners.forEach((n) => n(this.state));
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
isDuplicate(n) {
|
|
23
|
+
return this.state ? this.state.message === n.message && (this.state.type || "info") === (n.type || "info") && this.state.description === n.description && this.state.glassy === n.glassy : !1;
|
|
24
|
+
}
|
|
25
|
+
show(n) {
|
|
26
|
+
if (this.isDuplicate(n)) {
|
|
27
|
+
const x = n.duration ?? 4e3;
|
|
28
|
+
x > 0 && (this.startTime = Date.now(), this.remainingDuration = x, this.startTimer(x));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
23
31
|
this.dismiss();
|
|
24
|
-
const p =
|
|
32
|
+
const p = n.id || Math.random().toString(36).substring(2, 9), v = n.duration ?? 4e3;
|
|
25
33
|
this.state = {
|
|
26
|
-
...
|
|
34
|
+
...n,
|
|
27
35
|
id: p,
|
|
28
|
-
type:
|
|
36
|
+
type: n.type || "info",
|
|
29
37
|
duration: v
|
|
30
38
|
}, this.notify(), v > 0 && (this.startTime = Date.now(), this.remainingDuration = v, this.startTimer(v));
|
|
31
39
|
}
|
|
32
|
-
startTimer(
|
|
40
|
+
startTimer(n) {
|
|
33
41
|
this.timeoutId && clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => {
|
|
34
42
|
this.dismiss();
|
|
35
|
-
},
|
|
43
|
+
}, n);
|
|
36
44
|
}
|
|
37
45
|
pause() {
|
|
38
46
|
if (!this.state || !this.timeoutId || !this.startTime)
|
|
39
47
|
return;
|
|
40
48
|
clearTimeout(this.timeoutId), this.timeoutId = null;
|
|
41
|
-
const
|
|
42
|
-
this.remainingDuration = Math.max(0, (this.remainingDuration || 0) -
|
|
49
|
+
const n = Date.now() - this.startTime;
|
|
50
|
+
this.remainingDuration = Math.max(0, (this.remainingDuration || 0) - n), this.startTime = null;
|
|
43
51
|
}
|
|
44
52
|
resume() {
|
|
45
53
|
!this.state || this.timeoutId || this.remainingDuration === null || this.remainingDuration <= 0 || (this.startTime = Date.now(), this.startTimer(this.remainingDuration));
|
|
@@ -48,14 +56,14 @@ class gr {
|
|
|
48
56
|
this.timeoutId && (clearTimeout(this.timeoutId), this.timeoutId = null), this.state = null, this.startTime = null, this.remainingDuration = null, this.notify();
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
|
-
const
|
|
52
|
-
success: (i,
|
|
53
|
-
error: (i,
|
|
54
|
-
info: (i,
|
|
55
|
-
warning: (i,
|
|
56
|
-
dismiss: () =>
|
|
57
|
-
pause: () =>
|
|
58
|
-
resume: () =>
|
|
59
|
+
const j = new gr(), ke = {
|
|
60
|
+
success: (i, n) => j.show({ ...n, message: i, type: "success" }),
|
|
61
|
+
error: (i, n) => j.show({ ...n, message: i, type: "error" }),
|
|
62
|
+
info: (i, n) => j.show({ ...n, message: i, type: "info" }),
|
|
63
|
+
warning: (i, n) => j.show({ ...n, message: i, type: "warning" }),
|
|
64
|
+
dismiss: () => j.dismiss(),
|
|
65
|
+
pause: () => j.pause(),
|
|
66
|
+
resume: () => j.resume()
|
|
59
67
|
};
|
|
60
68
|
var re = { exports: {} }, N = {};
|
|
61
69
|
/**
|
|
@@ -72,18 +80,18 @@ function br() {
|
|
|
72
80
|
if (Ce)
|
|
73
81
|
return N;
|
|
74
82
|
Ce = 1;
|
|
75
|
-
var i = Oe,
|
|
76
|
-
function
|
|
77
|
-
var b,
|
|
78
|
-
P !== void 0 && (
|
|
83
|
+
var i = Oe, n = Symbol.for("react.element"), p = Symbol.for("react.fragment"), v = Object.prototype.hasOwnProperty, x = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, k = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
84
|
+
function w(R, m, P) {
|
|
85
|
+
var b, T = {}, C = null, M = null;
|
|
86
|
+
P !== void 0 && (C = "" + P), m.key !== void 0 && (C = "" + m.key), m.ref !== void 0 && (M = m.ref);
|
|
79
87
|
for (b in m)
|
|
80
|
-
v.call(m, b) && !
|
|
81
|
-
if (
|
|
82
|
-
for (b in m =
|
|
83
|
-
|
|
84
|
-
return { $$typeof:
|
|
88
|
+
v.call(m, b) && !k.hasOwnProperty(b) && (T[b] = m[b]);
|
|
89
|
+
if (R && R.defaultProps)
|
|
90
|
+
for (b in m = R.defaultProps, m)
|
|
91
|
+
T[b] === void 0 && (T[b] = m[b]);
|
|
92
|
+
return { $$typeof: n, type: R, key: C, ref: M, props: T, _owner: x.current };
|
|
85
93
|
}
|
|
86
|
-
return N.Fragment = p, N.jsx =
|
|
94
|
+
return N.Fragment = p, N.jsx = w, N.jsxs = w, N;
|
|
87
95
|
}
|
|
88
96
|
var Y = {};
|
|
89
97
|
/**
|
|
@@ -98,7 +106,7 @@ var Y = {};
|
|
|
98
106
|
var Se;
|
|
99
107
|
function Er() {
|
|
100
108
|
return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() {
|
|
101
|
-
var i = Oe,
|
|
109
|
+
var i = Oe, n = Symbol.for("react.element"), p = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), w = Symbol.for("react.provider"), R = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), te = Symbol.iterator, De = "@@iterator";
|
|
102
110
|
function Ie(e) {
|
|
103
111
|
if (e === null || typeof e != "object")
|
|
104
112
|
return null;
|
|
@@ -108,17 +116,17 @@ function Er() {
|
|
|
108
116
|
var D = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
109
117
|
function h(e) {
|
|
110
118
|
{
|
|
111
|
-
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0),
|
|
112
|
-
t[
|
|
119
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
|
|
120
|
+
t[a - 1] = arguments[a];
|
|
113
121
|
Ae("error", e, t);
|
|
114
122
|
}
|
|
115
123
|
}
|
|
116
124
|
function Ae(e, r, t) {
|
|
117
125
|
{
|
|
118
|
-
var
|
|
126
|
+
var a = D.ReactDebugCurrentFrame, l = a.getStackAddendum();
|
|
119
127
|
l !== "" && (r += "%s", t = t.concat([l]));
|
|
120
|
-
var c = t.map(function(
|
|
121
|
-
return String(
|
|
128
|
+
var c = t.map(function(o) {
|
|
129
|
+
return String(o);
|
|
122
130
|
});
|
|
123
131
|
c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
|
|
124
132
|
}
|
|
@@ -126,23 +134,23 @@ function Er() {
|
|
|
126
134
|
var Fe = !1, Le = !1, We = !1, $e = !1, Ne = !1, ne;
|
|
127
135
|
ne = Symbol.for("react.module.reference");
|
|
128
136
|
function Ye(e) {
|
|
129
|
-
return !!(typeof e == "string" || typeof e == "function" || e === v || e ===
|
|
137
|
+
return !!(typeof e == "string" || typeof e == "function" || e === v || e === k || Ne || e === x || e === P || e === b || $e || e === M || Fe || Le || We || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === T || e.$$typeof === w || e.$$typeof === R || e.$$typeof === m || // This needs to include all possible module reference object
|
|
130
138
|
// types supported by any Flight configuration anywhere since
|
|
131
139
|
// we don't know which Flight build this will end up being used
|
|
132
140
|
// with.
|
|
133
141
|
e.$$typeof === ne || e.getModuleId !== void 0));
|
|
134
142
|
}
|
|
135
143
|
function Me(e, r, t) {
|
|
136
|
-
var
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
144
|
+
var a = e.displayName;
|
|
145
|
+
if (a)
|
|
146
|
+
return a;
|
|
139
147
|
var l = r.displayName || r.name || "";
|
|
140
148
|
return l !== "" ? t + "(" + l + ")" : t;
|
|
141
149
|
}
|
|
142
150
|
function ae(e) {
|
|
143
151
|
return e.displayName || "Context";
|
|
144
152
|
}
|
|
145
|
-
function
|
|
153
|
+
function _(e) {
|
|
146
154
|
if (e == null)
|
|
147
155
|
return null;
|
|
148
156
|
if (typeof e.tag == "number" && h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
@@ -154,9 +162,9 @@ function Er() {
|
|
|
154
162
|
return "Fragment";
|
|
155
163
|
case p:
|
|
156
164
|
return "Portal";
|
|
157
|
-
case
|
|
165
|
+
case k:
|
|
158
166
|
return "Profiler";
|
|
159
|
-
case
|
|
167
|
+
case x:
|
|
160
168
|
return "StrictMode";
|
|
161
169
|
case P:
|
|
162
170
|
return "Suspense";
|
|
@@ -165,21 +173,21 @@ function Er() {
|
|
|
165
173
|
}
|
|
166
174
|
if (typeof e == "object")
|
|
167
175
|
switch (e.$$typeof) {
|
|
168
|
-
case
|
|
176
|
+
case R:
|
|
169
177
|
var r = e;
|
|
170
178
|
return ae(r) + ".Consumer";
|
|
171
|
-
case
|
|
179
|
+
case w:
|
|
172
180
|
var t = e;
|
|
173
181
|
return ae(t._context) + ".Provider";
|
|
174
182
|
case m:
|
|
175
183
|
return Me(e, e.render, "ForwardRef");
|
|
176
|
-
case
|
|
177
|
-
var
|
|
178
|
-
return
|
|
179
|
-
case
|
|
180
|
-
var l = e, c = l._payload,
|
|
184
|
+
case T:
|
|
185
|
+
var a = e.displayName || null;
|
|
186
|
+
return a !== null ? a : _(e.type) || "Memo";
|
|
187
|
+
case C: {
|
|
188
|
+
var l = e, c = l._payload, o = l._init;
|
|
181
189
|
try {
|
|
182
|
-
return
|
|
190
|
+
return _(o(c));
|
|
183
191
|
} catch {
|
|
184
192
|
return null;
|
|
185
193
|
}
|
|
@@ -187,14 +195,14 @@ function Er() {
|
|
|
187
195
|
}
|
|
188
196
|
return null;
|
|
189
197
|
}
|
|
190
|
-
var
|
|
198
|
+
var S = Object.assign, L = 0, ie, se, oe, ue, le, ce, fe;
|
|
191
199
|
function de() {
|
|
192
200
|
}
|
|
193
201
|
de.__reactDisabledLog = !0;
|
|
194
202
|
function Ve() {
|
|
195
203
|
{
|
|
196
204
|
if (L === 0) {
|
|
197
|
-
ie = console.log,
|
|
205
|
+
ie = console.log, se = console.info, oe = console.warn, ue = console.error, le = console.group, ce = console.groupCollapsed, fe = console.groupEnd;
|
|
198
206
|
var e = {
|
|
199
207
|
configurable: !0,
|
|
200
208
|
enumerable: !0,
|
|
@@ -223,25 +231,25 @@ function Er() {
|
|
|
223
231
|
writable: !0
|
|
224
232
|
};
|
|
225
233
|
Object.defineProperties(console, {
|
|
226
|
-
log:
|
|
234
|
+
log: S({}, e, {
|
|
227
235
|
value: ie
|
|
228
236
|
}),
|
|
229
|
-
info:
|
|
230
|
-
value: oe
|
|
231
|
-
}),
|
|
232
|
-
warn: C({}, e, {
|
|
237
|
+
info: S({}, e, {
|
|
233
238
|
value: se
|
|
234
239
|
}),
|
|
235
|
-
|
|
240
|
+
warn: S({}, e, {
|
|
241
|
+
value: oe
|
|
242
|
+
}),
|
|
243
|
+
error: S({}, e, {
|
|
236
244
|
value: ue
|
|
237
245
|
}),
|
|
238
|
-
group:
|
|
246
|
+
group: S({}, e, {
|
|
239
247
|
value: le
|
|
240
248
|
}),
|
|
241
|
-
groupCollapsed:
|
|
249
|
+
groupCollapsed: S({}, e, {
|
|
242
250
|
value: ce
|
|
243
251
|
}),
|
|
244
|
-
groupEnd:
|
|
252
|
+
groupEnd: S({}, e, {
|
|
245
253
|
value: fe
|
|
246
254
|
})
|
|
247
255
|
});
|
|
@@ -256,8 +264,8 @@ function Er() {
|
|
|
256
264
|
try {
|
|
257
265
|
throw Error();
|
|
258
266
|
} catch (l) {
|
|
259
|
-
var
|
|
260
|
-
K =
|
|
267
|
+
var a = l.stack.trim().match(/\n( *(at )?)/);
|
|
268
|
+
K = a && a[1] || "";
|
|
261
269
|
}
|
|
262
270
|
return `
|
|
263
271
|
` + K + e;
|
|
@@ -276,7 +284,7 @@ function Er() {
|
|
|
276
284
|
if (t !== void 0)
|
|
277
285
|
return t;
|
|
278
286
|
}
|
|
279
|
-
var
|
|
287
|
+
var a;
|
|
280
288
|
z = !0;
|
|
281
289
|
var l = Error.prepareStackTrace;
|
|
282
290
|
Error.prepareStackTrace = void 0;
|
|
@@ -284,49 +292,49 @@ function Er() {
|
|
|
284
292
|
c = q.current, q.current = null, Ve();
|
|
285
293
|
try {
|
|
286
294
|
if (r) {
|
|
287
|
-
var
|
|
295
|
+
var o = function() {
|
|
288
296
|
throw Error();
|
|
289
297
|
};
|
|
290
|
-
if (Object.defineProperty(
|
|
298
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
291
299
|
set: function() {
|
|
292
300
|
throw Error();
|
|
293
301
|
}
|
|
294
302
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
295
303
|
try {
|
|
296
|
-
Reflect.construct(
|
|
304
|
+
Reflect.construct(o, []);
|
|
297
305
|
} catch (g) {
|
|
298
|
-
|
|
306
|
+
a = g;
|
|
299
307
|
}
|
|
300
|
-
Reflect.construct(e, [],
|
|
308
|
+
Reflect.construct(e, [], o);
|
|
301
309
|
} else {
|
|
302
310
|
try {
|
|
303
|
-
|
|
311
|
+
o.call();
|
|
304
312
|
} catch (g) {
|
|
305
|
-
|
|
313
|
+
a = g;
|
|
306
314
|
}
|
|
307
|
-
e.call(
|
|
315
|
+
e.call(o.prototype);
|
|
308
316
|
}
|
|
309
317
|
} else {
|
|
310
318
|
try {
|
|
311
319
|
throw Error();
|
|
312
320
|
} catch (g) {
|
|
313
|
-
|
|
321
|
+
a = g;
|
|
314
322
|
}
|
|
315
323
|
e();
|
|
316
324
|
}
|
|
317
325
|
} catch (g) {
|
|
318
|
-
if (g &&
|
|
319
|
-
for (var
|
|
320
|
-
`), y =
|
|
321
|
-
`), f =
|
|
326
|
+
if (g && a && typeof g.stack == "string") {
|
|
327
|
+
for (var s = g.stack.split(`
|
|
328
|
+
`), y = a.stack.split(`
|
|
329
|
+
`), f = s.length - 1, d = y.length - 1; f >= 1 && d >= 0 && s[f] !== y[d]; )
|
|
322
330
|
d--;
|
|
323
331
|
for (; f >= 1 && d >= 0; f--, d--)
|
|
324
|
-
if (
|
|
332
|
+
if (s[f] !== y[d]) {
|
|
325
333
|
if (f !== 1 || d !== 1)
|
|
326
334
|
do
|
|
327
|
-
if (f--, d--, d < 0 ||
|
|
335
|
+
if (f--, d--, d < 0 || s[f] !== y[d]) {
|
|
328
336
|
var E = `
|
|
329
|
-
` +
|
|
337
|
+
` + s[f].replace(" at new ", " at ");
|
|
330
338
|
return e.displayName && E.includes("<anonymous>") && (E = E.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, E), E;
|
|
331
339
|
}
|
|
332
340
|
while (f >= 1 && d >= 0);
|
|
@@ -336,8 +344,8 @@ function Er() {
|
|
|
336
344
|
} finally {
|
|
337
345
|
z = !1, q.current = c, Ue(), Error.prepareStackTrace = l;
|
|
338
346
|
}
|
|
339
|
-
var A = e ? e.displayName || e.name : "",
|
|
340
|
-
return typeof e == "function" && U.set(e,
|
|
347
|
+
var A = e ? e.displayName || e.name : "", O = A ? V(A) : "";
|
|
348
|
+
return typeof e == "function" && U.set(e, O), O;
|
|
341
349
|
}
|
|
342
350
|
function Je(e, r, t) {
|
|
343
351
|
return ve(e, !1);
|
|
@@ -363,10 +371,10 @@ function Er() {
|
|
|
363
371
|
switch (e.$$typeof) {
|
|
364
372
|
case m:
|
|
365
373
|
return Je(e.render);
|
|
366
|
-
case
|
|
374
|
+
case T:
|
|
367
375
|
return B(e.type, r, t);
|
|
368
|
-
case
|
|
369
|
-
var
|
|
376
|
+
case C: {
|
|
377
|
+
var a = e, l = a._payload, c = a._init;
|
|
370
378
|
try {
|
|
371
379
|
return B(c(l), r, t);
|
|
372
380
|
} catch {
|
|
@@ -383,22 +391,22 @@ function Er() {
|
|
|
383
391
|
} else
|
|
384
392
|
pe.setExtraStackFrame(null);
|
|
385
393
|
}
|
|
386
|
-
function Ke(e, r, t,
|
|
394
|
+
function Ke(e, r, t, a, l) {
|
|
387
395
|
{
|
|
388
396
|
var c = Function.call.bind(W);
|
|
389
|
-
for (var
|
|
390
|
-
if (c(e,
|
|
391
|
-
var
|
|
397
|
+
for (var o in e)
|
|
398
|
+
if (c(e, o)) {
|
|
399
|
+
var s = void 0;
|
|
392
400
|
try {
|
|
393
|
-
if (typeof e[
|
|
394
|
-
var y = Error((
|
|
401
|
+
if (typeof e[o] != "function") {
|
|
402
|
+
var y = Error((a || "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`.");
|
|
395
403
|
throw y.name = "Invariant Violation", y;
|
|
396
404
|
}
|
|
397
|
-
|
|
405
|
+
s = e[o](r, o, a, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
398
406
|
} catch (f) {
|
|
399
|
-
|
|
407
|
+
s = f;
|
|
400
408
|
}
|
|
401
|
-
|
|
409
|
+
s && !(s instanceof Error) && (J(l), h("%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).", a || "React class", t, o, typeof s), J(null)), s instanceof Error && !(s.message in he) && (he[s.message] = !0, J(l), h("Failed %s type: %s", t, s.message), J(null));
|
|
402
410
|
}
|
|
403
411
|
}
|
|
404
412
|
}
|
|
@@ -451,8 +459,8 @@ function Er() {
|
|
|
451
459
|
}
|
|
452
460
|
function er(e, r) {
|
|
453
461
|
if (typeof e.ref == "string" && $.current && r && $.current.stateNode !== r) {
|
|
454
|
-
var t =
|
|
455
|
-
X[t] || (h('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',
|
|
462
|
+
var t = _($.current.type);
|
|
463
|
+
X[t] || (h('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', _($.current.type), e.ref), X[t] = !0);
|
|
456
464
|
}
|
|
457
465
|
}
|
|
458
466
|
function rr(e, r) {
|
|
@@ -477,51 +485,51 @@ function Er() {
|
|
|
477
485
|
});
|
|
478
486
|
}
|
|
479
487
|
}
|
|
480
|
-
var nr = function(e, r, t,
|
|
481
|
-
var
|
|
488
|
+
var nr = function(e, r, t, a, l, c, o) {
|
|
489
|
+
var s = {
|
|
482
490
|
// This tag allows us to uniquely identify this as a React Element
|
|
483
|
-
$$typeof:
|
|
491
|
+
$$typeof: n,
|
|
484
492
|
// Built-in properties that belong on the element
|
|
485
493
|
type: e,
|
|
486
494
|
key: r,
|
|
487
495
|
ref: t,
|
|
488
|
-
props:
|
|
496
|
+
props: o,
|
|
489
497
|
// Record the component responsible for creating this element.
|
|
490
498
|
_owner: c
|
|
491
499
|
};
|
|
492
|
-
return
|
|
500
|
+
return s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
493
501
|
configurable: !1,
|
|
494
502
|
enumerable: !1,
|
|
495
503
|
writable: !0,
|
|
496
504
|
value: !1
|
|
497
|
-
}), Object.defineProperty(
|
|
505
|
+
}), Object.defineProperty(s, "_self", {
|
|
498
506
|
configurable: !1,
|
|
499
507
|
enumerable: !1,
|
|
500
508
|
writable: !1,
|
|
501
|
-
value:
|
|
502
|
-
}), Object.defineProperty(
|
|
509
|
+
value: a
|
|
510
|
+
}), Object.defineProperty(s, "_source", {
|
|
503
511
|
configurable: !1,
|
|
504
512
|
enumerable: !1,
|
|
505
513
|
writable: !1,
|
|
506
514
|
value: l
|
|
507
|
-
}), Object.freeze && (Object.freeze(
|
|
515
|
+
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
508
516
|
};
|
|
509
|
-
function ar(e, r, t,
|
|
517
|
+
function ar(e, r, t, a, l) {
|
|
510
518
|
{
|
|
511
|
-
var c,
|
|
512
|
-
t !== void 0 && (ye(t),
|
|
519
|
+
var c, o = {}, s = null, y = null;
|
|
520
|
+
t !== void 0 && (ye(t), s = "" + t), Qe(r) && (ye(r.key), s = "" + r.key), Ze(r) && (y = r.ref, er(r, l));
|
|
513
521
|
for (c in r)
|
|
514
|
-
W.call(r, c) && !He.hasOwnProperty(c) && (
|
|
522
|
+
W.call(r, c) && !He.hasOwnProperty(c) && (o[c] = r[c]);
|
|
515
523
|
if (e && e.defaultProps) {
|
|
516
524
|
var f = e.defaultProps;
|
|
517
525
|
for (c in f)
|
|
518
|
-
|
|
526
|
+
o[c] === void 0 && (o[c] = f[c]);
|
|
519
527
|
}
|
|
520
|
-
if (
|
|
528
|
+
if (s || y) {
|
|
521
529
|
var d = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
522
|
-
|
|
530
|
+
s && rr(o, d), y && tr(o, d);
|
|
523
531
|
}
|
|
524
|
-
return nr(e,
|
|
532
|
+
return nr(e, s, y, l, a, $.current, o);
|
|
525
533
|
}
|
|
526
534
|
}
|
|
527
535
|
var H = D.ReactCurrentOwner, Ee = D.ReactDebugCurrentFrame;
|
|
@@ -535,12 +543,12 @@ function Er() {
|
|
|
535
543
|
var Z;
|
|
536
544
|
Z = !1;
|
|
537
545
|
function Q(e) {
|
|
538
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
546
|
+
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
539
547
|
}
|
|
540
548
|
function xe() {
|
|
541
549
|
{
|
|
542
550
|
if (H.current) {
|
|
543
|
-
var e =
|
|
551
|
+
var e = _(H.current.type);
|
|
544
552
|
if (e)
|
|
545
553
|
return `
|
|
546
554
|
|
|
@@ -561,7 +569,7 @@ Check your code at ` + r + ":" + t + ".";
|
|
|
561
569
|
}
|
|
562
570
|
}
|
|
563
571
|
var Re = {};
|
|
564
|
-
function
|
|
572
|
+
function sr(e) {
|
|
565
573
|
{
|
|
566
574
|
var r = xe();
|
|
567
575
|
if (!r) {
|
|
@@ -578,12 +586,12 @@ Check the top-level render call using <` + t + ">.");
|
|
|
578
586
|
if (!e._store || e._store.validated || e.key != null)
|
|
579
587
|
return;
|
|
580
588
|
e._store.validated = !0;
|
|
581
|
-
var t =
|
|
589
|
+
var t = sr(r);
|
|
582
590
|
if (Re[t])
|
|
583
591
|
return;
|
|
584
592
|
Re[t] = !0;
|
|
585
|
-
var
|
|
586
|
-
e && e._owner && e._owner !== H.current && (
|
|
593
|
+
var a = "";
|
|
594
|
+
e && e._owner && e._owner !== H.current && (a = " It was passed a child from " + _(e._owner.type) + "."), I(e), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), I(null);
|
|
587
595
|
}
|
|
588
596
|
}
|
|
589
597
|
function Te(e, r) {
|
|
@@ -592,20 +600,20 @@ Check the top-level render call using <` + t + ">.");
|
|
|
592
600
|
return;
|
|
593
601
|
if (G(e))
|
|
594
602
|
for (var t = 0; t < e.length; t++) {
|
|
595
|
-
var
|
|
596
|
-
Q(
|
|
603
|
+
var a = e[t];
|
|
604
|
+
Q(a) && _e(a, r);
|
|
597
605
|
}
|
|
598
606
|
else if (Q(e))
|
|
599
607
|
e._store && (e._store.validated = !0);
|
|
600
608
|
else if (e) {
|
|
601
609
|
var l = Ie(e);
|
|
602
610
|
if (typeof l == "function" && l !== e.entries)
|
|
603
|
-
for (var c = l.call(e),
|
|
604
|
-
Q(
|
|
611
|
+
for (var c = l.call(e), o; !(o = c.next()).done; )
|
|
612
|
+
Q(o.value) && _e(o.value, r);
|
|
605
613
|
}
|
|
606
614
|
}
|
|
607
615
|
}
|
|
608
|
-
function
|
|
616
|
+
function or(e) {
|
|
609
617
|
{
|
|
610
618
|
var r = e.type;
|
|
611
619
|
if (r == null || typeof r == "string")
|
|
@@ -615,16 +623,16 @@ Check the top-level render call using <` + t + ">.");
|
|
|
615
623
|
t = r.propTypes;
|
|
616
624
|
else if (typeof r == "object" && (r.$$typeof === m || // Note: Memo only checks outer props here.
|
|
617
625
|
// Inner props are checked in the reconciler.
|
|
618
|
-
r.$$typeof ===
|
|
626
|
+
r.$$typeof === T))
|
|
619
627
|
t = r.propTypes;
|
|
620
628
|
else
|
|
621
629
|
return;
|
|
622
630
|
if (t) {
|
|
623
|
-
var
|
|
624
|
-
Ke(t, e.props, "prop",
|
|
631
|
+
var a = _(r);
|
|
632
|
+
Ke(t, e.props, "prop", a, e);
|
|
625
633
|
} else if (r.PropTypes !== void 0 && !Z) {
|
|
626
634
|
Z = !0;
|
|
627
|
-
var l =
|
|
635
|
+
var l = _(r);
|
|
628
636
|
h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", l || "Unknown");
|
|
629
637
|
}
|
|
630
638
|
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
@@ -633,9 +641,9 @@ Check the top-level render call using <` + t + ">.");
|
|
|
633
641
|
function ur(e) {
|
|
634
642
|
{
|
|
635
643
|
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
636
|
-
var
|
|
637
|
-
if (
|
|
638
|
-
I(e), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
644
|
+
var a = r[t];
|
|
645
|
+
if (a !== "children" && a !== "key") {
|
|
646
|
+
I(e), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), I(null);
|
|
639
647
|
break;
|
|
640
648
|
}
|
|
641
649
|
}
|
|
@@ -643,24 +651,24 @@ Check the top-level render call using <` + t + ">.");
|
|
|
643
651
|
}
|
|
644
652
|
}
|
|
645
653
|
var je = {};
|
|
646
|
-
function we(e, r, t,
|
|
654
|
+
function we(e, r, t, a, l, c) {
|
|
647
655
|
{
|
|
648
|
-
var
|
|
649
|
-
if (!
|
|
650
|
-
var
|
|
651
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
656
|
+
var o = Ye(e);
|
|
657
|
+
if (!o) {
|
|
658
|
+
var s = "";
|
|
659
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
652
660
|
var y = ir(l);
|
|
653
|
-
y ?
|
|
661
|
+
y ? s += y : s += xe();
|
|
654
662
|
var f;
|
|
655
|
-
e === null ? f = "null" : G(e) ? f = "array" : e !== void 0 && e.$$typeof ===
|
|
663
|
+
e === null ? f = "null" : G(e) ? f = "array" : e !== void 0 && e.$$typeof === n ? (f = "<" + (_(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : f = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", f, s);
|
|
656
664
|
}
|
|
657
665
|
var d = ar(e, r, t, l, c);
|
|
658
666
|
if (d == null)
|
|
659
667
|
return d;
|
|
660
|
-
if (
|
|
668
|
+
if (o) {
|
|
661
669
|
var E = r.children;
|
|
662
670
|
if (E !== void 0)
|
|
663
|
-
if (
|
|
671
|
+
if (a)
|
|
664
672
|
if (G(E)) {
|
|
665
673
|
for (var A = 0; A < E.length; A++)
|
|
666
674
|
Te(E[A], e);
|
|
@@ -671,20 +679,20 @@ Check the top-level render call using <` + t + ">.");
|
|
|
671
679
|
Te(E, e);
|
|
672
680
|
}
|
|
673
681
|
if (W.call(r, "key")) {
|
|
674
|
-
var
|
|
682
|
+
var O = _(e), g = Object.keys(r).filter(function(hr) {
|
|
675
683
|
return hr !== "key";
|
|
676
684
|
}), ee = g.length > 0 ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
677
|
-
if (!je[
|
|
685
|
+
if (!je[O + ee]) {
|
|
678
686
|
var vr = g.length > 0 ? "{" + g.join(": ..., ") + ": ...}" : "{}";
|
|
679
687
|
h(`A props object containing a "key" prop is being spread into JSX:
|
|
680
688
|
let props = %s;
|
|
681
689
|
<%s {...props} />
|
|
682
690
|
React keys must be passed directly to JSX without using spread:
|
|
683
691
|
let props = %s;
|
|
684
|
-
<%s key={someKey} {...props} />`, ee,
|
|
692
|
+
<%s key={someKey} {...props} />`, ee, O, vr, O), je[O + ee] = !0;
|
|
685
693
|
}
|
|
686
694
|
}
|
|
687
|
-
return e === v ? ur(d) :
|
|
695
|
+
return e === v ? ur(d) : or(d), d;
|
|
688
696
|
}
|
|
689
697
|
}
|
|
690
698
|
function lr(e, r, t) {
|
|
@@ -715,12 +723,12 @@ const xr = () => /* @__PURE__ */ u.jsxs("svg", { width: "24", height: "24", view
|
|
|
715
723
|
/* @__PURE__ */ u.jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
716
724
|
/* @__PURE__ */ u.jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
717
725
|
] }), jr = ({ config: i }) => {
|
|
718
|
-
var
|
|
719
|
-
const [
|
|
726
|
+
var k, w;
|
|
727
|
+
const [n, p] = Pe(!1), v = () => {
|
|
720
728
|
p(!0), setTimeout(() => {
|
|
721
|
-
|
|
729
|
+
j.dismiss();
|
|
722
730
|
}, 300);
|
|
723
|
-
},
|
|
731
|
+
}, x = {
|
|
724
732
|
success: xr,
|
|
725
733
|
error: Rr,
|
|
726
734
|
info: _r,
|
|
@@ -729,23 +737,23 @@ const xr = () => /* @__PURE__ */ u.jsxs("svg", { width: "24", height: "24", view
|
|
|
729
737
|
return /* @__PURE__ */ u.jsxs(
|
|
730
738
|
"div",
|
|
731
739
|
{
|
|
732
|
-
className: `aura-toast ${i.type || "info"} ${i.glassy !== !1 ? "aura-toast-glassy" : ""} ${
|
|
740
|
+
className: `aura-toast ${i.type || "info"} ${i.glassy !== !1 ? "aura-toast-glassy" : ""} ${n ? "aura-toast-exit" : "aura-toast-enter"} ${i.className || ""}`,
|
|
733
741
|
onMouseEnter: () => ke.pause(),
|
|
734
742
|
onMouseLeave: () => ke.resume(),
|
|
735
743
|
style: {
|
|
736
744
|
...i.style,
|
|
737
|
-
...(
|
|
738
|
-
...(
|
|
745
|
+
...(k = i.style) != null && k["--type-color"] ? { "--type-color": i.style["--type-color"] } : {},
|
|
746
|
+
...(w = i.style) != null && w["--type-glow"] ? { "--type-glow": i.style["--type-glow"] } : {}
|
|
739
747
|
},
|
|
740
748
|
children: [
|
|
741
|
-
/* @__PURE__ */ u.jsx("div", { className: "aura-icon-container", children: /* @__PURE__ */ u.jsx("div", { className: "aura-icon", children: /* @__PURE__ */ u.jsx(
|
|
749
|
+
/* @__PURE__ */ u.jsx("div", { className: "aura-icon-container", children: /* @__PURE__ */ u.jsx("div", { className: "aura-icon", children: /* @__PURE__ */ u.jsx(x, {}) }) }),
|
|
742
750
|
/* @__PURE__ */ u.jsxs("div", { className: "aura-content", children: [
|
|
743
751
|
/* @__PURE__ */ u.jsx("p", { className: "aura-message", children: i.message }),
|
|
744
752
|
i.description && /* @__PURE__ */ u.jsx("p", { className: "aura-description", children: i.description })
|
|
745
753
|
] }),
|
|
746
754
|
i.action && /* @__PURE__ */ u.jsx("div", { className: "aura-action-container", children: /* @__PURE__ */ u.jsx("button", { className: "aura-action", onClick: () => {
|
|
747
|
-
var
|
|
748
|
-
(
|
|
755
|
+
var R;
|
|
756
|
+
(R = i.action) == null || R.onClick(), v();
|
|
749
757
|
}, children: i.action.label }) }),
|
|
750
758
|
/* @__PURE__ */ u.jsx("button", { className: "aura-close", onClick: v, "aria-label": "Close", children: /* @__PURE__ */ u.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
751
759
|
/* @__PURE__ */ u.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
@@ -756,17 +764,17 @@ const xr = () => /* @__PURE__ */ u.jsxs("svg", { width: "24", height: "24", view
|
|
|
756
764
|
);
|
|
757
765
|
};
|
|
758
766
|
const Cr = ({ children: i }) => {
|
|
759
|
-
const [
|
|
760
|
-
return yr(() =>
|
|
767
|
+
const [n, p] = Pe(null);
|
|
768
|
+
return yr(() => j.subscribe((v) => {
|
|
761
769
|
p(v);
|
|
762
770
|
}), []), /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
763
771
|
i,
|
|
764
|
-
/* @__PURE__ */ u.jsx("div", { className: "aura-container", children:
|
|
772
|
+
/* @__PURE__ */ u.jsx("div", { className: "aura-container", children: n && /* @__PURE__ */ u.jsx(
|
|
765
773
|
jr,
|
|
766
774
|
{
|
|
767
|
-
config:
|
|
775
|
+
config: n
|
|
768
776
|
},
|
|
769
|
-
|
|
777
|
+
n.id
|
|
770
778
|
) })
|
|
771
779
|
] });
|
|
772
780
|
};
|
|
@@ -774,5 +782,5 @@ export {
|
|
|
774
782
|
Cr as AuraProvider,
|
|
775
783
|
jr as AuraToast,
|
|
776
784
|
ke as auraToast,
|
|
777
|
-
|
|
785
|
+
j as toastStore
|
|
778
786
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aura-toast",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"homepage": "https://damicode18.github.io/aura-toast/",
|
|
5
5
|
"description": "Premium React toast notifications with glassmorphism design. Lightweight, customizable, and enforces a single-toast constraint for clean UI.",
|
|
6
6
|
"main": "dist/aura-toast.cjs.js",
|