@edinelsonslima/toast-notification 0.0.31 → 0.1.32

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 CHANGED
@@ -61,35 +61,37 @@ export default function MyComponent(){
61
61
  #### O que é disponível com o pacote
62
62
  | função | propriedades |
63
63
  |--------------------|------------------------------------------------------------|
64
- | ToastContainer | `classNames` `position` |
64
+ | ToastContainer | `classNames` `position` `defaultDuration` |
65
65
  | toast | `text` `type` `duration` |
66
- | style | `/dist/style.css` |
66
+ | style | `/dist/style.css` |
67
67
 
68
68
  #### As propriedades da função toast
69
69
  |propriedade | toast |
70
70
  |--------------------|----------------------------------------------------------- |
71
- | text | A mensagem que aparecerá dentro do toast |
71
+ | content | A conteúdo que aparecerá dentro do toast |
72
72
  | type | Define o tipo de toast que é para aparecer |
73
73
  | duration | O tempo que o toast irá permanecer em tela |
74
74
 
75
75
  #### As propriedades do componente ToastContainer
76
76
  |propriedade | ToastContainer |
77
77
  |--------------------|----------------------------------------------------------- |
78
- | classNames | Um objeto de **chave:valor** onde a chave é o tipo de toast e o valor pode ser uma string (classNames) ou um objeto (CSSProperties) |
79
- | position | Define em qual parte da tela irá aparecer a toast notification, existe valores predefinidos |
78
+ | classNames | Um objeto de **chave:valor** onde a chave é o tipo de toast e o valor pode ser uma string (classNames) ou um objeto (CSSProperties) |
79
+ | position | Define em qual parte da tela irá aparecer a toast notification, existe valores predefinidos |
80
+ | defaultDuration | Define tempo padrão de duração de todas as toast |
80
81
 
81
82
  #### Mais detalhes sobre as propriedades
82
- | propriedade |tipo | é obrigatório | padrão |
83
- |-------------|-------|-----------------|-------------|
84
- | text |string | sim | - |
85
- | type |string | sim | - |
86
- | duration |number | não | 7_0000 |
87
- | classNames |object | não | undefined |
88
- | position |string | não | right-top |
83
+ | propriedade |tipo | é obrigatório | padrão |
84
+ |-----------------|---------|-----------------|-------------|
85
+ | content |ReactNode| sim | - |
86
+ | type |string | sim | - |
87
+ | duration |number | não | 7_0000 |
88
+ | defaultDuration |number | não | - |
89
+ | classNames |object | não | undefined |
90
+ | position |string | não | right-top |
89
91
 
90
- ℹ️ O `duration` está em ms (milissegundos)
92
+ ℹ️ O `duration` e `defaultDuration` estão em ms (milissegundos)
91
93
 
92
- ℹ️ A função `toast` pode ser chamada de duas forma, veja os exemplos a seguir:
94
+ ℹ️ A função `toast` pode ser chamada de algumas formas, veja os exemplos a seguir:
93
95
 
94
96
  caso seja chamada direta, será obrigatório informa o **type**
95
97
  ```ts
@@ -99,6 +101,15 @@ ou pode acessar o tipo do toast diretamente, assim omitindo ele do objeto enviad
99
101
  ```ts
100
102
  toast.info({ text: "mensagem exemplo", durantino: 1000 * 4 })
101
103
  ```
104
+ ```ts
105
+ toast.info('mensagem exemplo')
106
+ ```
107
+ ```tsx
108
+ toast.info(<strong>mensagem exemplo</strong>)
109
+ ```
110
+ ```tsx
111
+ toast.info(<MeuComponente>mensagem exemplo</MeuComponente>)
112
+ ```
102
113
 
103
114
 
104
115
 
package/dist/index.d.ts CHANGED
@@ -1,29 +1,36 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
3
+ import { ReactNode } from 'react';
3
4
 
4
- declare interface IToast {
5
- text: string;
5
+ declare type IReactNode = Omit<ReactNode, "object"> | undefined;
6
+
7
+ declare interface IToast extends IToastWithoutType {
6
8
  type: "success" | "info" | "warn" | "error" | "ghost";
7
- duration?: number;
8
9
  }
9
10
 
10
11
  export declare interface IToastContainerProps {
12
+ defaultDuration?: number;
11
13
  classNames?: {
12
14
  [type in IToast["type"]]?: HTMLButtonElement["className"] | CSSProperties;
13
15
  };
14
16
  position?: "right-top" | "right-center" | "right-bottom" | "center-top" | "center-center" | "center-bottom" | "left-top" | "left-center" | "left-bottom";
15
17
  }
16
18
 
17
- export declare function toast({ duration, text, type }: IToast): void;
19
+ declare interface IToastWithoutType {
20
+ content: IReactNode;
21
+ duration?: number;
22
+ }
23
+
24
+ export declare function toast({ duration, content, type }: IToast): void;
18
25
 
19
26
  export declare namespace toast {
20
- var error: ({ duration, text }: Omit<IToast, "type">) => void;
21
- var success: ({ duration, text }: Omit<IToast, "type">) => void;
22
- var warn: ({ duration, text }: Omit<IToast, "type">) => void;
23
- var info: ({ duration, text }: Omit<IToast, "type">) => void;
24
- var ghost: ({ duration, text }: Omit<IToast, "type">) => void;
27
+ var error: (data: IToastWithoutType | IReactNode) => void;
28
+ var success: (data: IToastWithoutType | IReactNode) => void;
29
+ var warn: (data: IToastWithoutType | IReactNode) => void;
30
+ var info: (data: IToastWithoutType | IReactNode) => void;
31
+ var ghost: (data: IToastWithoutType | IReactNode) => void;
25
32
  }
26
33
 
27
- export declare function ToastContainer({ classNames, position, }: IToastContainerProps): JSX_2.Element;
34
+ export declare function ToastContainer({ classNames, defaultDuration, position, }: IToastContainerProps): JSX_2.Element;
28
35
 
29
36
  export { }
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(y,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],p):(y=typeof globalThis<"u"?globalThis:y||self,p(y["toast-notification"]={},y.React))})(this,function(y,p){"use strict";var yr=Object.defineProperty;var Er=(y,p,x)=>p in y?yr(y,p,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[p]=x;var ke=(y,p,x)=>(Er(y,typeof p!="symbol"?p+"":p,x),x);class x{constructor(){ke(this,"listeners",new Map([]))}on(i,g){var c;this.listeners.has(i)||this.listeners.set(i,[]),(c=this.listeners.get(i))==null||c.push(g)}emit(i,g){var c;this.listeners.has(i)&&((c=this.listeners.get(i))==null||c.forEach(b=>b(g)))}removeListener(i,g){const c=this.listeners.get(i);if(!c)return;const b=c.filter(l=>l!==g);this.listeners.set(i,b)}}const J=new x;function O({duration:u,text:i,type:g}){J.emit("add-toast",{duration:u,text:i,type:g})}O.error=({duration:u,text:i})=>O({duration:u,text:i,type:"error"}),O.success=({duration:u,text:i})=>O({duration:u,text:i,type:"success"}),O.warn=({duration:u,text:i})=>O({duration:u,text:i,type:"warn"}),O.info=({duration:u,text:i})=>O({duration:u,text:i,type:"info"}),O.ghost=({duration:u,text:i})=>O({duration:u,text:i,type:"ghost"});var G={exports:{}},L={};/**
1
+ (function(b,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(b=typeof globalThis<"u"?globalThis:b||self,l(b["toast-notification"]={},b.React))})(this,function(b,l){"use strict";var br=Object.defineProperty;var Rr=(b,l,x)=>l in b?br(b,l,{enumerable:!0,configurable:!0,writable:!0,value:x}):b[l]=x;var Ie=(b,l,x)=>(Rr(b,typeof l!="symbol"?l+"":l,x),x);class x{constructor(){Ie(this,"listeners",new Map([]))}on(u,g){var c;this.listeners.has(u)||this.listeners.set(u,[]),(c=this.listeners.get(u))==null||c.push(g)}emit(u,g){var c;this.listeners.has(u)&&((c=this.listeners.get(u))==null||c.forEach(R=>R(g)))}removeListener(u,g){const c=this.listeners.get(u);if(!c)return;const R=c.filter(h=>h!==g);this.listeners.set(u,R)}}function L(s){return function(u){if(l.isValidElement(u))return j({content:u,type:s});const{content:g,duration:c}=u;return j({content:g,duration:c,type:s})}}function Ae(s){if(s)return l.isValidElement(s)||typeof s!="object"||Array.isArray(s)?s:JSON.stringify(s)}const G=new x;function j({duration:s,content:u,type:g}){u=Ae(u),G.emit("add-toast",{content:u,duration:s,type:g})}j.error=L("error"),j.success=L("success"),j.warn=L("warn"),j.info=L("info"),j.ghost=L("ghost");var K={exports:{}},M={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.development.js
4
4
  *
@@ -6,17 +6,17 @@
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 ae;function Ie(){return ae||(ae=1,process.env.NODE_ENV!=="production"&&function(){var u=p,i=Symbol.for("react.element"),g=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),E=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),U=Symbol.for("react.offscreen"),ie=Symbol.iterator,We="@@iterator";function Ye(e){if(e===null||typeof e!="object")return null;var r=ie&&e[ie]||e[We];return typeof r=="function"?r:null}var D=u.__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),n=1;n<r;n++)t[n-1]=arguments[n];Ue("error",e,t)}}function Ue(e,r,t){{var n=D.ReactDebugCurrentFrame,s=n.getStackAddendum();s!==""&&(r+="%s",t=t.concat([s]));var f=t.map(function(o){return String(o)});f.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,f)}}var Ve=!1,ze=!1,$e=!1,Ne=!1,Be=!1,se;se=Symbol.for("react.module.reference");function Je(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===l||Be||e===b||e===w||e===R||Ne||e===U||Ve||ze||$e||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===S||e.$$typeof===T||e.$$typeof===E||e.$$typeof===_||e.$$typeof===se||e.getModuleId!==void 0))}function Ge(e,r,t){var n=e.displayName;if(n)return n;var s=r.displayName||r.name||"";return s!==""?t+"("+s+")":t}function ue(e){return e.displayName||"Context"}function P(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 c:return"Fragment";case g:return"Portal";case l:return"Profiler";case b:return"StrictMode";case w:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var r=e;return ue(r)+".Consumer";case T:var t=e;return ue(t._context)+".Provider";case _:return Ge(e,e.render,"ForwardRef");case S:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case k:{var s=e,f=s._payload,o=s._init;try{return P(o(f))}catch{return null}}}return null}var I=Object.assign,W=0,fe,ce,le,de,ve,pe,_e;function ge(){}ge.__reactDisabledLog=!0;function Ke(){{if(W===0){fe=console.log,ce=console.info,le=console.warn,de=console.error,ve=console.group,pe=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ge,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function He(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:fe}),info:I({},e,{value:ce}),warn:I({},e,{value:le}),error:I({},e,{value:de}),group:I({},e,{value:ve}),groupCollapsed:I({},e,{value:pe}),groupEnd:I({},e,{value:_e})})}W<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=D.ReactCurrentDispatcher,q;function V(e,r,t){{if(q===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);q=n&&n[1]||""}return`
10
- `+q+e}}var Z=!1,z;{var Xe=typeof WeakMap=="function"?WeakMap:Map;z=new Xe}function he(e,r){if(!e||Z)return"";{var t=z.get(e);if(t!==void 0)return t}var n;Z=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=X.current,X.current=null,Ke();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(j){n=j}Reflect.construct(e,[],o)}else{try{o.call()}catch(j){n=j}e.call(o.prototype)}}else{try{throw Error()}catch(j){n=j}e()}}catch(j){if(j&&n&&typeof j.stack=="string"){for(var a=j.stack.split(`
11
- `),m=n.stack.split(`
12
- `),d=a.length-1,v=m.length-1;d>=1&&v>=0&&a[d]!==m[v];)v--;for(;d>=1&&v>=0;d--,v--)if(a[d]!==m[v]){if(d!==1||v!==1)do if(d--,v--,v<0||a[d]!==m[v]){var C=`
13
- `+a[d].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&z.set(e,C),C}while(d>=1&&v>=0);break}}}finally{Z=!1,X.current=f,He(),Error.prepareStackTrace=s}var F=e?e.displayName||e.name:"",xe=F?V(F):"";return typeof e=="function"&&z.set(e,xe),xe}function qe(e,r,t){return he(e,!1)}function Ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function $(e,r,t){if(e==null)return"";if(typeof e=="function")return he(e,Ze(e));if(typeof e=="string")return V(e);switch(e){case w:return V("Suspense");case R:return V("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case _:return qe(e.render);case S:return $(e.type,r,t);case k:{var n=e,s=n._payload,f=n._init;try{return $(f(s),r,t)}catch{}}}return""}var N=Object.prototype.hasOwnProperty,me={},ye=D.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);ye.setExtraStackFrame(t)}else ye.setExtraStackFrame(null)}function Qe(e,r,t,n,s){{var f=Function.call.bind(N);for(var o in e)if(f(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var m=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 m.name="Invariant Violation",m}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}a&&!(a instanceof Error)&&(B(s),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).",n||"React class",t,o,typeof a),B(null)),a instanceof Error&&!(a.message in me)&&(me[a.message]=!0,B(s),h("Failed %s type: %s",t,a.message),B(null))}}}var er=Array.isArray;function Q(e){return er(e)}function rr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function tr(e){try{return Ee(e),!1}catch{return!0}}function Ee(e){return""+e}function be(e){if(tr(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",rr(e)),Ee(e)}var Y=D.ReactCurrentOwner,nr={key:!0,ref:!0,__self:!0,__source:!0},Re,Te,ee;ee={};function ar(e){if(N.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function or(e){if(N.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ir(e,r){if(typeof e.ref=="string"&&Y.current&&r&&Y.current.stateNode!==r){var t=P(Y.current.type);ee[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',P(Y.current.type),e.ref),ee[t]=!0)}}function sr(e,r){{var t=function(){Re||(Re=!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 ur(e,r){{var t=function(){Te||(Te=!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 fr=function(e,r,t,n,s,f,o){var a={$$typeof:i,type:e,key:r,ref:t,props:o,_owner:f};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:s}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function cr(e,r,t,n,s){{var f,o={},a=null,m=null;t!==void 0&&(be(t),a=""+t),or(r)&&(be(r.key),a=""+r.key),ar(r)&&(m=r.ref,ir(r,s));for(f in r)N.call(r,f)&&!nr.hasOwnProperty(f)&&(o[f]=r[f]);if(e&&e.defaultProps){var d=e.defaultProps;for(f in d)o[f]===void 0&&(o[f]=d[f])}if(a||m){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&sr(o,v),m&&ur(o,v)}return fr(e,a,m,s,n,Y.current,o)}}var re=D.ReactCurrentOwner,Ce=D.ReactDebugCurrentFrame;function A(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}var te;te=!1;function ne(e){return typeof e=="object"&&e!==null&&e.$$typeof===i}function Oe(){{if(re.current){var e=P(re.current.type);if(e)return`
9
+ */var oe;function De(){return oe||(oe=1,process.env.NODE_ENV!=="production"&&function(){var s=l,u=Symbol.for("react.element"),g=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),T=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),se=Symbol.iterator,Ue="@@iterator";function Ve(e){if(e===null||typeof e!="object")return null;var r=se&&e[se]||e[Ue];return typeof r=="function"?r:null}var A=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];ze("error",e,t)}}function ze(e,r,t){{var n=A.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var f=t.map(function(o){return String(o)});f.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,f)}}var Ne=!1,$e=!1,Be=!1,Je=!1,Ge=!1,ue;ue=Symbol.for("react.module.reference");function Ke(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===h||Ge||e===R||e===w||e===m||Je||e===V||Ne||$e||Be||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===O||e.$$typeof===_||e.$$typeof===T||e.$$typeof===d||e.$$typeof===ue||e.getModuleId!==void 0))}function He(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function fe(e){return e.displayName||"Context"}function S(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 g:return"Portal";case h:return"Profiler";case R:return"StrictMode";case w:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:var r=e;return fe(r)+".Consumer";case _:var t=e;return fe(t._context)+".Provider";case d:return He(e,e.render,"ForwardRef");case O:var n=e.displayName||null;return n!==null?n:S(e.type)||"Memo";case k:{var i=e,f=i._payload,o=i._init;try{return S(o(f))}catch{return null}}}return null}var I=Object.assign,Y=0,ce,le,de,ve,pe,ge,_e;function he(){}he.__reactDisabledLog=!0;function Xe(){{if(Y===0){ce=console.log,le=console.info,de=console.warn,ve=console.error,pe=console.group,ge=console.groupCollapsed,_e=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})}Y++}}function Ze(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:ce}),info:I({},e,{value:le}),warn:I({},e,{value:de}),error:I({},e,{value:ve}),group:I({},e,{value:pe}),groupCollapsed:I({},e,{value:ge}),groupEnd:I({},e,{value:_e})})}Y<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=A.ReactCurrentDispatcher,q;function z(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`
10
+ `+q+e}}var Q=!1,N;{var qe=typeof WeakMap=="function"?WeakMap:Map;N=new qe}function me(e,r){if(!e||Q)return"";{var t=N.get(e);if(t!==void 0)return t}var n;Q=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=Z.current,Z.current=null,Xe();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(P){n=P}Reflect.construct(e,[],o)}else{try{o.call()}catch(P){n=P}e.call(o.prototype)}}else{try{throw Error()}catch(P){n=P}e()}}catch(P){if(P&&n&&typeof P.stack=="string"){for(var a=P.stack.split(`
11
+ `),E=n.stack.split(`
12
+ `),v=a.length-1,p=E.length-1;v>=1&&p>=0&&a[v]!==E[p];)p--;for(;v>=1&&p>=0;v--,p--)if(a[v]!==E[p]){if(v!==1||p!==1)do if(v--,p--,p<0||a[v]!==E[p]){var C=`
13
+ `+a[v].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&N.set(e,C),C}while(v>=1&&p>=0);break}}}finally{Q=!1,Z.current=f,Ze(),Error.prepareStackTrace=i}var F=e?e.displayName||e.name:"",ke=F?z(F):"";return typeof e=="function"&&N.set(e,ke),ke}function Qe(e,r,t){return me(e,!1)}function er(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function $(e,r,t){if(e==null)return"";if(typeof e=="function")return me(e,er(e));if(typeof e=="string")return z(e);switch(e){case w:return z("Suspense");case m:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Qe(e.render);case O:return $(e.type,r,t);case k:{var n=e,i=n._payload,f=n._init;try{return $(f(i),r,t)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,ye={},Ee=A.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(t)}else Ee.setExtraStackFrame(null)}function rr(e,r,t,n,i){{var f=Function.call.bind(B);for(var o in e)if(f(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var E=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 E.name="Invariant Violation",E}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){a=v}a&&!(a instanceof Error)&&(J(i),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).",n||"React class",t,o,typeof a),J(null)),a instanceof Error&&!(a.message in ye)&&(ye[a.message]=!0,J(i),y("Failed %s type: %s",t,a.message),J(null))}}}var tr=Array.isArray;function ee(e){return tr(e)}function nr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ar(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function Re(e){if(ar(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nr(e)),be(e)}var U=A.ReactCurrentOwner,or={key:!0,ref:!0,__self:!0,__source:!0},Te,Ce,re;re={};function ir(e){if(B.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function sr(e){if(B.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ur(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=S(U.current.type);re[t]||(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',S(U.current.type),e.ref),re[t]=!0)}}function fr(e,r){{var t=function(){Te||(Te=!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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function cr(e,r){{var t=function(){Ce||(Ce=!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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var lr=function(e,r,t,n,i,f,o){var a={$$typeof:u,type:e,key:r,ref:t,props:o,_owner:f};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 dr(e,r,t,n,i){{var f,o={},a=null,E=null;t!==void 0&&(Re(t),a=""+t),sr(r)&&(Re(r.key),a=""+r.key),ir(r)&&(E=r.ref,ur(r,i));for(f in r)B.call(r,f)&&!or.hasOwnProperty(f)&&(o[f]=r[f]);if(e&&e.defaultProps){var v=e.defaultProps;for(f in v)o[f]===void 0&&(o[f]=v[f])}if(a||E){var p=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&fr(o,p),E&&cr(o,p)}return lr(e,a,E,i,n,U.current,o)}}var te=A.ReactCurrentOwner,Oe=A.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}var ne;ne=!1;function ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function we(){{if(te.current){var e=S(te.current.type);if(e)return`
14
14
 
15
- Check the render method of \``+e+"`."}return""}}function lr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
15
+ Check the render method of \``+e+"`."}return""}}function vr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
16
16
 
17
- Check your code at `+r+":"+t+"."}return""}}var we={};function dr(e){{var r=Oe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
17
+ Check your code at `+r+":"+t+"."}return""}}var Se={};function pr(e){{var r=we();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
18
18
 
19
- Check the top-level render call using <`+t+">.")}return r}}function Se(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=dr(r);if(we[t])return;we[t]=!0;var n="";e&&e._owner&&e._owner!==re.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),A(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,n),A(null)}}function Pe(e,r){{if(typeof e!="object")return;if(Q(e))for(var t=0;t<e.length;t++){var n=e[t];ne(n)&&Se(n,r)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var s=Ye(e);if(typeof s=="function"&&s!==e.entries)for(var f=s.call(e),o;!(o=f.next()).done;)ne(o.value)&&Se(o.value,r)}}}function vr(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===_||r.$$typeof===S))t=r.propTypes;else return;if(t){var n=P(r);Qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!te){te=!0;var s=P(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"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 pr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){A(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),A(null);break}}e.ref!==null&&(A(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function je(e,r,t,n,s,f){{var o=Je(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 m=lr(s);m?a+=m:a+=Oe();var d;e===null?d="null":Q(e)?d="array":e!==void 0&&e.$$typeof===i?(d="<"+(P(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):d=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",d,a)}var v=cr(e,r,t,s,f);if(v==null)return v;if(o){var C=r.children;if(C!==void 0)if(n)if(Q(C)){for(var F=0;F<C.length;F++)Pe(C[F],e);Object.freeze&&Object.freeze(C)}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 Pe(C,e)}return e===c?pr(v):vr(v),v}}function _r(e,r,t){return je(e,r,t,!0)}function gr(e,r,t){return je(e,r,t,!1)}var hr=gr,mr=_r;L.Fragment=c,L.jsx=hr,L.jsxs=mr}()),L}var M={};/**
19
+ Check the top-level render call using <`+t+">.")}return r}}function Pe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=pr(r);if(Se[t])return;Se[t]=!0;var n="";e&&e._owner&&e._owner!==te.current&&(n=" It was passed a child from "+S(e._owner.type)+"."),D(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.',t,n),D(null)}}function je(e,r){{if(typeof e!="object")return;if(ee(e))for(var t=0;t<e.length;t++){var n=e[t];ae(n)&&Pe(n,r)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var i=Ve(e);if(typeof i=="function"&&i!==e.entries)for(var f=i.call(e),o;!(o=f.next()).done;)ae(o.value)&&Pe(o.value,r)}}}function gr(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===d||r.$$typeof===O))t=r.propTypes;else return;if(t){var n=S(r);rr(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ne){ne=!0;var i=S(r);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function _r(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){D(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),D(null);break}}e.ref!==null&&(D(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}function xe(e,r,t,n,i,f){{var o=Ke(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 E=vr(i);E?a+=E:a+=we();var v;e===null?v="null":ee(e)?v="array":e!==void 0&&e.$$typeof===u?(v="<"+(S(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):v=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",v,a)}var p=dr(e,r,t,i,f);if(p==null)return p;if(o){var C=r.children;if(C!==void 0)if(n)if(ee(C)){for(var F=0;F<C.length;F++)je(C[F],e);Object.freeze&&Object.freeze(C)}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 je(C,e)}return e===c?_r(p):gr(p),p}}function hr(e,r,t){return xe(e,r,t,!0)}function mr(e,r,t){return xe(e,r,t,!1)}var yr=mr,Er=hr;M.Fragment=c,M.jsx=yr,M.jsxs=Er}()),M}var W={};/**
20
20
  * @license React
21
21
  * react-jsx-runtime.production.min.js
22
22
  *
@@ -24,4 +24,4 @@ Check the top-level render call using <`+t+">.")}return r}}function Se(e,r){{if(
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */var oe;function De(){if(oe)return M;oe=1;var u=p,i=Symbol.for("react.element"),g=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,b=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function T(E,_,w){var R,S={},k=null,U=null;w!==void 0&&(k=""+w),_.key!==void 0&&(k=""+_.key),_.ref!==void 0&&(U=_.ref);for(R in _)c.call(_,R)&&!l.hasOwnProperty(R)&&(S[R]=_[R]);if(E&&E.defaultProps)for(R in _=E.defaultProps,_)S[R]===void 0&&(S[R]=_[R]);return{$$typeof:i,type:E,key:k,ref:U,props:S,_owner:b.current}}return M.Fragment=g,M.jsx=T,M.jsxs=T,M}process.env.NODE_ENV==="production"?G.exports=De():G.exports=Ie();var K=G.exports;const H={"toast-container":"_toast-container_1p5ze_5","toast-message":"_toast-message_1p5ze_29",screenRightIn:"_screenRightIn_1p5ze_1",screenCenterIn:"_screenCenterIn_1p5ze_1",screenLeftIn:"_screenLeftIn_1p5ze_1",screenOut:"_screenOut_1p5ze_1",success:"_success_1p5ze_111",info:"_info_1p5ze_115",warn:"_warn_1p5ze_120",error:"_error_1p5ze_124",ghost:"_ghost_1p5ze_129"};function Ae({message:{duration:u=1e3*7,id:i,text:g,type:c},onRemoveMessage:b,classNames:l}){const[T,E]=p.useState(!1);function _(){T&&b(i)}return p.useEffect(()=>{const w=setTimeout(()=>E(!0),u);return()=>clearTimeout(w)},[b,i,u]),K.jsx("button",{tabIndex:0,onAnimationEnd:_,onClick:()=>E(!0),"data-animation-end":T,style:Fe(l==null?void 0:l[c]),className:`${H["toast-message"]} ${H[c]} ${Le(l==null?void 0:l[c])}`,children:g})}function Fe(u){if(!(!u||typeof u!="object"))return u}function Le(u){return!u||typeof u!="string"?"":u}function Me({classNames:u,position:i="right-top"}){const[g,c]=p.useState([]),b=p.useCallback(l=>{c(T=>T.filter(E=>E.id!==l))},[]);return p.useEffect(()=>{function l({text:T,duration:E,type:_}){c(w=>[...w,{id:crypto.randomUUID(),text:T,duration:E,type:_}])}return J.on("add-toast",l),()=>{J.removeListener("add-toast",l)}},[]),K.jsx("div",{"data-position":i,className:H["toast-container"],children:g.map(l=>K.jsx(Ae,{message:l,classNames:u,onRemoveMessage:b},l.id))})}y.ToastContainer=Me,y.toast=O,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
27
+ */var ie;function Fe(){if(ie)return W;ie=1;var s=l,u=Symbol.for("react.element"),g=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,R=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function _(T,d,w){var m,O={},k=null,V=null;w!==void 0&&(k=""+w),d.key!==void 0&&(k=""+d.key),d.ref!==void 0&&(V=d.ref);for(m in d)c.call(d,m)&&!h.hasOwnProperty(m)&&(O[m]=d[m]);if(T&&T.defaultProps)for(m in d=T.defaultProps,d)O[m]===void 0&&(O[m]=d[m]);return{$$typeof:u,type:T,key:k,ref:V,props:O,_owner:R.current}}return W.Fragment=g,W.jsx=_,W.jsxs=_,W}process.env.NODE_ENV==="production"?K.exports=Fe():K.exports=De();var H=K.exports;const X={"toast-container":"_toast-container_1p5ze_5","toast-message":"_toast-message_1p5ze_29",screenRightIn:"_screenRightIn_1p5ze_1",screenCenterIn:"_screenCenterIn_1p5ze_1",screenLeftIn:"_screenLeftIn_1p5ze_1",screenOut:"_screenOut_1p5ze_1",success:"_success_1p5ze_111",info:"_info_1p5ze_115",warn:"_warn_1p5ze_120",error:"_error_1p5ze_124",ghost:"_ghost_1p5ze_129"};function Le({message:{duration:s=1e3*7,id:u,content:g,type:c},onRemoveMessage:R,classNames:h}){const[_,T]=l.useState(!1);function d(){_&&R(u)}return l.useEffect(()=>{const w=setTimeout(()=>T(!0),s);return()=>clearTimeout(w)},[R,u,s]),H.jsx("button",{tabIndex:0,onAnimationEnd:d,onClick:()=>T(!0),"data-animation-end":_,style:Me(h==null?void 0:h[c]),className:`${X["toast-message"]} ${X[c]} ${We(h==null?void 0:h[c])}`,children:g})}function Me(s){if(!(!s||typeof s!="object"))return s}function We(s){return!s||typeof s!="string"?"":s}function Ye({classNames:s,defaultDuration:u,position:g="right-top"}){const[c,R]=l.useState([]),h=l.useCallback(_=>{R(T=>T.filter(d=>d.id!==_))},[]);return l.useEffect(()=>{function _(T){const{content:d,type:w,duration:m=u}=T;R(O=>[...O,{id:crypto.randomUUID(),content:d,duration:m,type:w}])}return G.on("add-toast",_),()=>{G.removeListener("add-toast",_)}},[u]),H.jsx("div",{"data-position":g,className:X["toast-container"],children:c.map(_=>H.jsx(Le,{message:_,classNames:s,onRemoveMessage:h},_.id))})}b.ToastContainer=Ye,b.toast=j,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edinelsonslima/toast-notification",
3
- "version": "0.0.31",
3
+ "version": "0.1.32",
4
4
  "author": "@edinelsonslima",
5
5
  "type": "module",
6
6
  "license": "MIT",