aura-toast 1.4.0 → 1.5.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/README.md +38 -21
- package/dist/aura-toast.cjs.js +11 -11
- package/dist/aura-toast.es.js +545 -452
- package/dist/core/ToastStore.d.ts +14 -13
- package/dist/react/AuraProvider.d.ts +1 -0
- package/dist/react/AuraToast.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,16 +43,20 @@ bun add aura-toast
|
|
|
43
43
|
|
|
44
44
|
## Quick Start (React)
|
|
45
45
|
|
|
46
|
-
1. Import the styles in your main entry file (e.g., `main.tsx` or `App.tsx`):
|
|
46
|
+
1. Import the styles and the provider in your main entry file (e.g., `main.tsx` or `App.tsx`):
|
|
47
47
|
|
|
48
48
|
```tsx
|
|
49
|
+
import { AuraProvider } from 'aura-toast';
|
|
49
50
|
import 'aura-toast/dist/style.css';
|
|
50
|
-
```
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
// Wrap your app. Optionally pass stack={true} to allow multiple layered toasts.
|
|
53
|
+
function App() {
|
|
54
|
+
return (
|
|
55
|
+
<AuraProvider stack={true}>
|
|
56
|
+
<YourApp />
|
|
57
|
+
</AuraProvider>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
56
60
|
```
|
|
57
61
|
|
|
58
62
|
## Live Demo
|
|
@@ -60,7 +64,7 @@ import { AuraProvider } from 'aura-toast';
|
|
|
60
64
|
Check out the interactive showcase: [Live Demo Link (GitHub Pages/Vercel)]
|
|
61
65
|
|
|
62
66
|
> [!TIP]
|
|
63
|
-
> **
|
|
67
|
+
> **Layout Modes**: AuraToast defaults to a single-toast focused mode. Each new toast elegantly replaces the previous one. If you prefer keeping history on screen, simply pass `stack={true}` to your `<AuraProvider>` to enable a beautiful layered card stack!
|
|
64
68
|
|
|
65
69
|
2. Trigger toasts using the `auraToast` object:
|
|
66
70
|
|
|
@@ -69,12 +73,19 @@ import { auraToast } from 'aura-toast';
|
|
|
69
73
|
|
|
70
74
|
function MyComponent() {
|
|
71
75
|
const handleClick = () => {
|
|
76
|
+
// You can pass a string title and a config object:
|
|
72
77
|
auraToast.success('Changes saved successfully!', {
|
|
78
|
+
description: 'Your database has been updated.',
|
|
73
79
|
action: {
|
|
74
80
|
label: 'Undo',
|
|
75
81
|
onClick: () => console.log('Undo clicked'),
|
|
76
82
|
}
|
|
77
83
|
});
|
|
84
|
+
|
|
85
|
+
// Or pass just a config object natively (Title is completely optional!)
|
|
86
|
+
auraToast.info({
|
|
87
|
+
description: 'System maintenance scheduled for 3AM.'
|
|
88
|
+
});
|
|
78
89
|
};
|
|
79
90
|
|
|
80
91
|
return <button onClick={handleClick}>Save</button>;
|
|
@@ -92,42 +103,48 @@ import { auraToast, toastStore } from 'aura-toast';
|
|
|
92
103
|
import 'aura-toast/dist/style.css';
|
|
93
104
|
|
|
94
105
|
// 1. Subscribe to the store to handle rendering
|
|
95
|
-
toastStore.subscribe((
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
console.log('
|
|
106
|
+
toastStore.subscribe((state) => {
|
|
107
|
+
// state is an array of ToastConfig objects
|
|
108
|
+
if (state.length > 0) {
|
|
109
|
+
console.log('Active toasts:', state);
|
|
99
110
|
} else {
|
|
100
|
-
|
|
101
|
-
console.log('Hide toast');
|
|
111
|
+
console.log('No active toasts');
|
|
102
112
|
}
|
|
103
113
|
});
|
|
104
114
|
|
|
105
115
|
// 2. Trigger toasts as usual
|
|
106
|
-
auraToast.success('Works in Vanilla JS too!');
|
|
116
|
+
auraToast.success({ title: 'Works in Vanilla JS too!' });
|
|
107
117
|
```
|
|
108
118
|
|
|
109
119
|
## API
|
|
110
120
|
|
|
111
|
-
### `auraToast.success(
|
|
112
|
-
### `auraToast.error(
|
|
113
|
-
### `auraToast.info(
|
|
114
|
-
### `auraToast.warning(
|
|
115
|
-
### `auraToast.
|
|
121
|
+
### `auraToast.success(titleOrConfig, config?)`
|
|
122
|
+
### `auraToast.error(titleOrConfig, config?)`
|
|
123
|
+
### `auraToast.info(titleOrConfig, config?)`
|
|
124
|
+
### `auraToast.warning(titleOrConfig, config?)`
|
|
125
|
+
### `auraToast.promise(promise, { loading, success, error }, config?)`
|
|
126
|
+
### `auraToast.dismiss(id?)`
|
|
116
127
|
|
|
117
128
|
#### Configuration Object
|
|
118
129
|
| Property | Type | Description |
|
|
119
130
|
| --- | --- | --- |
|
|
120
|
-
| `
|
|
131
|
+
| `title` | ` ReactNode` | The main title of the toast. |
|
|
132
|
+
| `description` | `ReactNode` | Smaller subtitle text below the title. |
|
|
133
|
+
| `duration` | `number` | Time in ms before auto-dismiss (default: 4000). Set to `0` for **sticky** toasts. |
|
|
134
|
+
| `position` | `ToastPosition` | E.g. `'top-right'`, `'bottom-center'`. |
|
|
121
135
|
| `action` | `{ label: string, onClick: () => void }` | Optional action button. |
|
|
136
|
+
| `glassy` | `boolean` | Enable or disable premium backdrop-blur effects. |
|
|
122
137
|
|
|
123
138
|
## Customization
|
|
124
139
|
|
|
125
|
-
You can override the default styles by providing values for these CSS variables:
|
|
140
|
+
You can override the default styles and typography by providing values for these CSS variables natively in your app or within the `style` prop of a specific toast:
|
|
126
141
|
|
|
127
142
|
```css
|
|
128
143
|
:root {
|
|
129
144
|
--aura-bg: rgba(17, 25, 40, 0.75);
|
|
130
145
|
--aura-success: #10b981;
|
|
146
|
+
--toast-font-size-title: 0.875rem;
|
|
147
|
+
--toast-font-size-desc: 0.75rem;
|
|
131
148
|
/* ... see aura-toast.css for more */
|
|
132
149
|
}
|
|
133
150
|
```
|
package/dist/aura-toast.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var yt=Object.defineProperty;var mt=(a,r,i)=>r in a?yt(a,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[r]=i;var W=(a,r,i)=>(mt(a,typeof r!="symbol"?r+"":r,i),i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./react"),Fe=5;class gt{constructor(){W(this,"state",[]);W(this,"listeners",new Set);W(this,"timeouts",new Map);W(this,"startTimes",new Map);W(this,"remainingDurations",new Map)}getState(){return this.state}subscribe(r){return this.listeners.add(r),()=>this.listeners.delete(r)}notify(){this.listeners.forEach(r=>r(this.state))}isDuplicate(r){return this.state.some(i=>i.title===r.title&&(i.type||"info")===(r.type||"info")&&i.description===r.description&&i.glassy===r.glassy)}show(r){if(this.isDuplicate(r)){const h=this.state.find(x=>x.title===r.title&&(x.type||"info")===(r.type||"info")&&x.description===r.description&&x.glassy===r.glassy);if(h&&h.id){const x=r.duration??4e3;x>0&&(this.startTimes.set(h.id,Date.now()),this.remainingDurations.set(h.id,x),this.startTimer(h.id,x))}return}const i=r.id||Math.random().toString(36).substring(2,9),c=r.duration??4e3,E={...r,id:i,type:r.type||"info",duration:c};if(this.state=[E,...this.state],this.state.length>Fe){const h=this.state[this.state.length-1];h&&h.id&&this.clearTimerData(h.id),this.state=this.state.slice(0,Fe)}this.notify(),c>0&&(this.startTimes.set(i,Date.now()),this.remainingDurations.set(i,c),this.startTimer(i,c))}startTimer(r,i){this.timeouts.has(r)&&clearTimeout(this.timeouts.get(r));const c=setTimeout(()=>{this.dismiss(r)},i);this.timeouts.set(r,c)}clearTimerData(r){this.timeouts.has(r)&&(clearTimeout(this.timeouts.get(r)),this.timeouts.delete(r)),this.startTimes.delete(r),this.remainingDurations.delete(r)}pause(){this.state.forEach(r=>{const i=r.id;if(this.timeouts.has(i)&&this.startTimes.has(i)){clearTimeout(this.timeouts.get(i)),this.timeouts.delete(i);const c=this.startTimes.get(i),E=Date.now()-c,h=this.remainingDurations.get(i)||0;this.remainingDurations.set(i,Math.max(0,h-E)),this.startTimes.delete(i)}})}resume(){this.state.forEach(r=>{const i=r.id,c=this.remainingDurations.get(i);!this.timeouts.has(i)&&c!==void 0&&c>0&&(this.startTimes.set(i,Date.now()),this.startTimer(i,c))})}dismiss(r){r?(this.clearTimerData(r),this.state=this.state.filter(i=>i.id!==r)):(this.timeouts.forEach(i=>clearTimeout(i)),this.timeouts.clear(),this.startTimes.clear(),this.remainingDurations.clear(),this.state=[]),this.notify()}}const w=new gt,fe={success:(a,r)=>{const i=typeof a=="string"?{...r,title:a}:{...r,...a};return w.show({...i,type:"success"})},error:(a,r)=>{const i=typeof a=="string"?{...r,title:a}:{...r,...a};return w.show({...i,type:"error"})},info:(a,r)=>{const i=typeof a=="string"?{...r,title:a}:{...r,...a};return w.show({...i,type:"info"})},warning:(a,r)=>{const i=typeof a=="string"?{...r,title:a}:{...r,...a};return w.show({...i,type:"warning"})},promise:(a,r,i)=>{const c=(i==null?void 0:i.id)||Math.random().toString(36).substring(2,9),E=typeof r.loading=="string"?{...i,title:r.loading}:{...i,...r.loading};return w.show({...E,id:c,type:"loading",duration:0}),a.then(()=>{w.dismiss(c);const h=typeof r.success=="string"?{...i,title:r.success}:{...i,...r.success};w.show({...h,id:c,type:"success"})}).catch(()=>{w.dismiss(c);const h=typeof r.error=="string"?{...i,title:r.error}:{...i,...r.error};w.show({...h,id:c,type:"error"})}),a},dismiss:a=>w.dismiss(a),pause:()=>w.pause(),resume:()=>w.resume()};var de={exports:{}},V={};/**
|
|
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
|
|
9
|
+
*/var We;function bt(){if(We)return V;We=1;var a=D,r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,E=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function x(g,v,O){var b,T={},S=null,R=null;O!==void 0&&(S=""+O),v.key!==void 0&&(S=""+v.key),v.ref!==void 0&&(R=v.ref);for(b in v)c.call(v,b)&&!h.hasOwnProperty(b)&&(T[b]=v[b]);if(g&&g.defaultProps)for(b in v=g.defaultProps,v)T[b]===void 0&&(T[b]=v[b]);return{$$typeof:r,type:g,key:S,ref:R,props:T,_owner:E.current}}return V.Fragment=i,V.jsx=x,V.jsxs=x,V}var z={};/**
|
|
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
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var $e;function Et(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){var a=D,r=Symbol.for("react.element"),i=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),g=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),C=Symbol.iterator,X="@@iterator";function H(e){if(e===null||typeof e!="object")return null;var t=C&&e[C]||e[X];return typeof t=="function"?t:null}var A=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];Z("error",e,n)}}function Z(e,t,n){{var s=A.ReactDebugCurrentFrame,f=s.getStackAddendum();f!==""&&(t+="%s",n=n.concat([f]));var d=n.map(function(u){return String(u)});d.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,d)}}var Q=!1,ee=!1,te=!1,U=!1,$=!1,he;he=Symbol.for("react.module.reference");function Ye(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===h||$||e===E||e===O||e===b||U||e===R||Q||ee||te||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===T||e.$$typeof===x||e.$$typeof===g||e.$$typeof===v||e.$$typeof===he||e.getModuleId!==void 0))}function Be(e,t,n){var s=e.displayName;if(s)return s;var f=t.displayName||t.name||"";return f!==""?n+"("+f+")":n}function ve(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&y("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 c:return"Fragment";case i:return"Portal";case h:return"Profiler";case E:return"StrictMode";case O:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case g:var t=e;return ve(t)+".Consumer";case x:var n=e;return ve(n._context)+".Provider";case v:return Be(e,e.render,"ForwardRef");case T:var s=e.displayName||null;return s!==null?s:P(e.type)||"Memo";case S:{var f=e,d=f._payload,u=f._init;try{return P(u(d))}catch{return null}}}return null}var M=Object.assign,N=0,pe,ye,me,ge,be,Ee,xe;function Te(){}Te.__reactDisabledLog=!0;function Ve(){{if(N===0){pe=console.log,ye=console.info,me=console.warn,ge=console.error,be=console.group,Ee=console.groupCollapsed,xe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function ze(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:pe}),info:M({},e,{value:ye}),warn:M({},e,{value:me}),error:M({},e,{value:ge}),group:M({},e,{value:be}),groupCollapsed:M({},e,{value:Ee}),groupEnd:M({},e,{value:xe})})}N<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=A.ReactCurrentDispatcher,ne;function q(e,t,n){{if(ne===void 0)try{throw Error()}catch(f){var s=f.stack.trim().match(/\n( *(at )?)/);ne=s&&s[1]||""}return`
|
|
18
|
+
`+ne+e}}var ie=!1,J;{var Ue=typeof WeakMap=="function"?WeakMap:Map;J=new Ue}function Re(e,t){if(!e||ie)return"";{var n=J.get(e);if(n!==void 0)return n}var s;ie=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var d;d=re.current,re.current=null,Ve();try{if(t){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(j){s=j}Reflect.construct(e,[],u)}else{try{u.call()}catch(j){s=j}e.call(u.prototype)}}else{try{throw Error()}catch(j){s=j}e()}}catch(j){if(j&&s&&typeof j.stack=="string"){for(var o=j.stack.split(`
|
|
19
|
+
`),_=s.stack.split(`
|
|
20
|
+
`),p=o.length-1,m=_.length-1;p>=1&&m>=0&&o[p]!==_[m];)m--;for(;p>=1&&m>=0;p--,m--)if(o[p]!==_[m]){if(p!==1||m!==1)do if(p--,m--,m<0||o[p]!==_[m]){var k=`
|
|
21
|
+
`+o[p].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,k),k}while(p>=1&&m>=0);break}}}finally{ie=!1,re.current=d,ze(),Error.prepareStackTrace=f}var F=e?e.displayName||e.name:"",I=F?q(F):"";return typeof e=="function"&&J.set(e,I),I}function qe(e,t,n){return Re(e,!1)}function Je(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function K(e,t,n){if(e==null)return"";if(typeof e=="function")return Re(e,Je(e));if(typeof e=="string")return q(e);switch(e){case O:return q("Suspense");case b:return q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return qe(e.render);case T:return K(e.type,t,n);case S:{var s=e,f=s._payload,d=s._init;try{return K(d(f),t,n)}catch{}}}return""}var Y=Object.prototype.hasOwnProperty,_e={},we=A.ReactDebugCurrentFrame;function G(e){if(e){var t=e._owner,n=K(e.type,e._source,t?t.type:null);we.setExtraStackFrame(n)}else we.setExtraStackFrame(null)}function Ke(e,t,n,s,f){{var d=Function.call.bind(Y);for(var u in e)if(d(e,u)){var o=void 0;try{if(typeof e[u]!="function"){var _=Error((s||"React class")+": "+n+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}o=e[u](t,u,s,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(p){o=p}o&&!(o instanceof Error)&&(G(f),y("%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).",s||"React class",n,u,typeof o),G(null)),o instanceof Error&&!(o.message in _e)&&(_e[o.message]=!0,G(f),y("Failed %s type: %s",n,o.message),G(null))}}}var Ge=Array.isArray;function ae(e){return Ge(e)}function Xe(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function He(e){try{return je(e),!1}catch{return!0}}function je(e){return""+e}function Se(e){if(He(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xe(e)),je(e)}var B=A.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0},Ce,ke,se;se={};function Qe(e){if(Y.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function et(e){if(Y.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function tt(e,t){if(typeof e.ref=="string"&&B.current&&t&&B.current.stateNode!==t){var n=P(B.current.type);se[n]||(y('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',P(B.current.type),e.ref),se[n]=!0)}}function rt(e,t){{var n=function(){Ce||(Ce=!0,y("%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)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function nt(e,t){{var n=function(){ke||(ke=!0,y("%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)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var it=function(e,t,n,s,f,d,u){var o={$$typeof:r,type:e,key:t,ref:n,props:u,_owner:d};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function at(e,t,n,s,f){{var d,u={},o=null,_=null;n!==void 0&&(Se(n),o=""+n),et(t)&&(Se(t.key),o=""+t.key),Qe(t)&&(_=t.ref,tt(t,f));for(d in t)Y.call(t,d)&&!Ze.hasOwnProperty(d)&&(u[d]=t[d]);if(e&&e.defaultProps){var p=e.defaultProps;for(d in p)u[d]===void 0&&(u[d]=p[d])}if(o||_){var m=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&rt(u,m),_&&nt(u,m)}return it(e,o,_,f,s,B.current,u)}}var oe=A.ReactCurrentOwner,Oe=A.ReactDebugCurrentFrame;function L(e){if(e){var t=e._owner,n=K(e.type,e._source,t?t.type:null);Oe.setExtraStackFrame(n)}else Oe.setExtraStackFrame(null)}var ue;ue=!1;function le(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Pe(){{if(oe.current){var e=P(oe.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function st(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),n=e.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+
|
|
25
|
+
Check your code at `+t+":"+n+"."}return""}}var De={};function ot(e){{var t=Pe();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+
|
|
27
|
+
Check the top-level render call using <`+n+">.")}return t}}function Ae(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=ot(t);if(De[n])return;De[n]=!0;var s="";e&&e._owner&&e._owner!==oe.current&&(s=" It was passed a child from "+P(e._owner.type)+"."),L(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,s),L(null)}}function Me(e,t){{if(typeof e!="object")return;if(ae(e))for(var n=0;n<e.length;n++){var s=e[n];le(s)&&Ae(s,t)}else if(le(e))e._store&&(e._store.validated=!0);else if(e){var f=H(e);if(typeof f=="function"&&f!==e.entries)for(var d=f.call(e),u;!(u=d.next()).done;)le(u.value)&&Ae(u.value,t)}}}function ut(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===T))n=t.propTypes;else return;if(n){var s=P(t);Ke(n,e.props,"prop",s,e)}else if(t.PropTypes!==void 0&&!ue){ue=!0;var f=P(t);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function lt(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var s=t[n];if(s!=="children"&&s!=="key"){L(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),L(null);break}}e.ref!==null&&(L(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}var Ie={};function Le(e,t,n,s,f,d){{var u=Ye(e);if(!u){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" 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 _=st(f);_?o+=_:o+=Pe();var p;e===null?p="null":ae(e)?p="array":e!==void 0&&e.$$typeof===r?(p="<"+(P(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):p=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",p,o)}var m=at(e,t,n,f,d);if(m==null)return m;if(u){var k=t.children;if(k!==void 0)if(s)if(ae(k)){for(var F=0;F<k.length;F++)Me(k[F],e);Object.freeze&&Object.freeze(k)}else y("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 Me(k,e)}if(Y.call(t,"key")){var I=P(e),j=Object.keys(t).filter(function(pt){return pt!=="key"}),ce=j.length>0?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}";if(!Ie[I+ce]){var vt=j.length>0?"{"+j.join(": ..., ")+": ...}":"{}";y(`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} />`,
|
|
32
|
+
<%s key={someKey} {...props} />`,ce,I,vt,I),Ie[I+ce]=!0}}return e===c?lt(m):ut(m),m}}function ct(e,t,n){return Le(e,t,n,!0)}function ft(e,t,n){return Le(e,t,n,!1)}var dt=ft,ht=ct;z.Fragment=c,z.jsx=dt,z.jsxs=ht}()),z}process.env.NODE_ENV==="production"?de.exports=bt():de.exports=Et();var l=de.exports;const xt=()=>l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),l.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),Tt=()=>l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),l.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),Rt=()=>l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),l.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),_t=()=>l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.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"}),l.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),l.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),wt=()=>l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"aura-spinner",children:l.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"})}),Ne=({config:a,index:r=0,isStacked:i=!1,totalToasts:c=1,onHeight:E})=>{var b,T,S,R;const[h,x]=D.useState(!1),g=D.useRef(null);D.useEffect(()=>{g.current&&E&&E(g.current.getBoundingClientRect().height);const C=()=>{g.current&&E&&E(g.current.getBoundingClientRect().height)};return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[a.title,a.description,E]);const v=()=>{x(!0),setTimeout(()=>{w.dismiss(a.id)},300)},O={success:xt,error:Tt,info:Rt,warning:_t,loading:wt}[a.type||"info"];return l.jsxs("div",{ref:g,className:`aura-toast ${a.type||"info"} ${a.glassy!==!1?"aura-toast-glassy":""} ${h?"aura-toast-exit":"aura-toast-enter"} ${a.className||""}`,onMouseEnter:()=>fe.pause(),onMouseLeave:()=>fe.resume(),style:{...a.style,...(b=a.style)!=null&&b["--type-color"]?{"--type-color":a.style["--type-color"]}:{},...(T=a.style)!=null&&T["--type-glow"]?{"--type-glow":a.style["--type-glow"]}:{},...(S=a.style)!=null&&S["--toast-font-size-title"]?{"--toast-font-size-title":a.style["--toast-font-size-title"]}:{},...(R=a.style)!=null&&R["--toast-font-size-desc"]?{"--toast-font-size-desc":a.style["--toast-font-size-desc"]}:{}},children:[l.jsx("div",{className:"aura-icon-container",children:l.jsx("div",{className:"aura-icon",children:l.jsx(O,{})})}),l.jsxs("div",{className:"aura-content",children:[a.title&&l.jsx("p",{className:"aura-title",children:a.title}),a.description&&l.jsx("p",{className:"aura-description",children:a.description})]}),a.action&&l.jsx("div",{className:"aura-action-container",children:l.jsx("button",{className:"aura-action",onClick:()=>{var C;(C=a.action)==null||C.onClick(),v()},children:a.action.label})}),l.jsx("button",{className:"aura-close",onClick:v,"aria-label":"Close",children:l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})};const jt=({children:a,className:r,stack:i=!1})=>{const[c,E]=D.useState([]),[h,x]=D.useState({}),[g,v]=D.useState(!1);D.useEffect(()=>w.subscribe(R=>{E(R||[])}),[]);const O=i?c:c.slice(0,1),b=c.length>0&&c[0].position||"top-right",T=b.startsWith("top");let S=0;return l.jsxs("div",{className:r,children:[a,l.jsx("div",{className:`aura-container ${b}`,"data-stack":i,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:O.map((R,C)=>{const X=h[R.id]||80,H=S;S+=X+16;const A=C*16;let y=0;i&&(y=g?H:A);const Z=T?y:-y,Q=i&&!g?Math.max(0,1-C*.03):1,ee=100-C,te=i&&!g&&C>3?0:1;return l.jsx("div",{className:"aura-toast-wrapper",style:{gridArea:i?"1 / 1":"auto",zIndex:ee,transform:`translateY(${Z}px) scale(${Q})`,transformOrigin:T?"top center":"bottom center",opacity:te,transition:"all 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28)",pointerEvents:"auto",paddingBottom:g&&i&&T?"16px":"0",paddingTop:g&&i&&!T?"16px":"0"},children:l.jsx(Ne,{config:R,isStacked:i,onHeight:U=>{x($=>$[R.id]===U?$:{...$,[R.id]:U})}})},R.id)})})]})};exports.AuraProvider=jt;exports.AuraToast=Ne;exports.auraToast=fe;exports.toastStore=w;
|